grep replacement

William Sommerfeld wesommer at athena.mit.edu
Sun Jun 12 18:17:26 AEST 1988


In article <144 at insyte.UUCP> jad at insyte.UUCP writes:
>A missing feature in UNIX is the ability to deal with files with
>very long lines - the kind of file you get from a data base tape like
>Compustat.  The standard data base tape contains very long lines.
>Instead of separating each record with a newline, all the records may
>be on the same line.  There is a defined record size which is used to
>determine when a record ends - instead of a newline.
>
>There are two specific things that it would be nice to do with UNIX, 
>instead of having to write a c program:

As usual with UNIX, you _don't_ have to write a C program.  Use `dd'
instead.  If we're talking about the canonical IBM "80 column card
image", then the following should work just fine to convert it to a
"normal" file:

dd conv=unblock cbs=80 <in >out

Adding conv=ascii will also convert EBCDIC into ascii.

>2) To be able to specify a field range (ie columns 20-30) for the 
>program to search - instead of the entire line/record.  

grep '^........foo' 

picks up any line which has `foo' in columns 9-11..

					- Bill



More information about the Comp.unix.wizards mailing list