slicing the date
Dan Bernstein
bernsten at phoenix.Princeton.EDU
Wed Apr 5 08:47:43 AEST 1989
In article <18941 at adm.BRL.MIL> mchinni at pica.army.mil (Michael J. Chinni, SMCAR-CCS-E) writes:
> Alan,
>
> Since you do not have cut at all, I don't know how you could do this
> w/o using some type of cut-like utility. What you might want to do it to get
> the public-domain versions of cut and paste from the unix-sources archives.
I believe the cut command in question was something like ``cut -c12-19''
for extracting columns 12 through 19 of a file. If you don't have easy
access to uunet, can't reach smoke.brl.mil, don't feel like getting cut
and paste to work, prefer speed and simplicity, or are just lazy, you
might try the primitive ``type of cut-like utility'' known as colrm.
colrm 20 | colrm 1 11
is quite a bit faster than cut -c12-19, can handle long lines, and
doesn't require cut in the first place. Note that it reacts differently
to tabs, though expand and unexpand negate the difference.
(I once moved a shell script to a machine without cut. I felt even more
stupid than usual when I realized I could have used colrm in the first
place.)
---Dan Bernstein, bernsten at phoenix.princeton.edu
More information about the Comp.unix.questions
mailing list