|
|
read first N bytes from binary file in shell
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.
|
|
0
|
|
|
|
Reply
|
ivanov.roman (1)
|
6/9/2010 8:51:40 AM |
|
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
|
|
0
|
|
|
|
Reply
|
Chris
|
6/9/2010 9:04:19 AM
|
|
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
|
|
0
|
|
|
|
Reply
|
pomah
|
6/9/2010 9:54:57 AM
|
|
|
2 Replies
1512 Views
(page loaded in 0.402 seconds)
|
|
|
|
|
|
|
|
|