Problem using multiple 'head' commands in shell script
Bob Peirce #305
rbp at investor.pgh.pa.us
Mon Feb 4 23:26:52 AEST 1991
In article <1671 at abekrd.UUCP> garyb at abekrd.UUCP (Gary Bartlett) writes:
>Can someone explain to me what is happening with the following Bourne shell
>script and more importantly how I can get around it:
>
> cat file | (
> head -200
> echo "Line 201 follows"
> head -200
> echo "Line 401 follows"
> cat
> )
>
>I am trying to use 'head' as a quick way to split up an input stream. I
>originally used 'read' and an 'expr' counter but this was too slow.
>
>This script loses lines after each 'head'. eg if file contained a stream of
>numbers, the output would be missing lots of numbers!
>
Why not use
cat file | split -200
commands to process x?? files
--
Bob Peirce, Pittsburgh, PA 412-471-5320
...!uunet!pitt!investor!rbp rbp at investor.pgh.pa.us
More information about the Comp.unix.shell
mailing list