"dd conv=unblock cbs=80 - really grep replacement"
Guy Harris
guy at gorodish.Sun.COM
Fri Jul 1 04:13:05 AEST 1988
> >Either your "strings" is busted or you have a crippled V3.1. The
> >vanilla AT&T 3.1 source tape includes a dd.c that implements this
> >command.
>
> Two things: first I am using HP-UX which does not have 'conv=block'
> documented so its probably not implemented either.
Bad assumption. UNIX systems have lots of features that aren't documented.
S5R3's documentation doesn't mention "conv=block", or any of the other V7 or
4BSD "dd" features, but they're all there.
> More importantly, this is NOT a good solution. (I could easily write
> a c program to reformat the file if I wanted to.) The files that
> we deal with are very very large data files. Making a reformated
> copy of the file is not a good solution.
How about piping the output of "dd" to "grep"? This obviates the need to make
a reformatted copy.
> Ideally, grep could be passed a record size which it would use instead
> of newlines. And/Or grep could be told to only search specified columns
> of every record. This would enable me to easily deal with these files
> without tieing up either memory or disk space.
I'm sure there are zillions of options that could be added to "grep" that would
make somebody's life easier. However, if the same job can be done with a
pipeline, it's not clear that "grep" *should* have all those options added.
"grep" is intended to work on UNIX text files; extending it to work on various
other random file formats might be nice, but it might also cause a lot of
rather specialized options to be added, most of which are good at *some* jobs
but not for other closely related jobs.
I think the demand for this particular capability is sufficiently low that
you're not likely to see it provided in "gre" proper; however, I seem to
remember reading that the guts of "gre" would be provided as library routines,
so if one has a specialized task such as the one described, and the existing
UNIX tools either couldn't do it or were too slow, one could write a
specialized program to do it.
More information about the Comp.unix.wizards
mailing list