From: pomah on
Hi ALL,

I have one big file 46Mb size.
I need to send first N=(46Mb - 17) bytes of this file to STDIN of
another process without going to disk.
Any solutions?

tail is for tail
head does not support per characters/bytes
dd count=N bs=1 is terribly slow
awk will go crasy about binary file.

Any suggestions? I have to be in /bin/sh Solaris10.
From: Chris Ridd on
On 2010-06-09 09:51:40 +0100, pomah said:

> Hi ALL,
>
> I have one big file 46Mb size.
> I need to send first N=(46Mb - 17) bytes of this file to STDIN of
> another process without going to disk.
> Any solutions?
>
> tail is for tail
> head does not support per characters/bytes
> dd count=N bs=1 is terribly slow

How about dd count=1 bs=N ?

> awk will go crasy about binary file.
>
> Any suggestions? I have to be in /bin/sh Solaris10.

As you're able to call things like awk, tail, head, can you also call
things like perl? This would be easy to do in perl.
--
Chris

From: pomah on
Thanks, Chris

> > I have one big file 46Mb size.
> > I need to send first N=(46Mb - 17) bytes of this file to STDIN of
> > another process without going to disk.
> > Any solutions?
>
> > tail is for tail
> > head does not support per characters/bytes
> > dd count=N bs=1 is terribly slow
>
> How about dd count=1 bs=N ?

Strange, did several runs and got different output file size....
Will try perl, thanks!
R.

>
> > awk will go crasy about binary file.
>
> > Any suggestions? I have to be in /bin/sh Solaris10.
>
> As you're able to call things like awk, tail, head, can you also call
> things like perl? This would be easy to do in perl.
> --
> Chris