"cut" needed to run CC

Dominic Dunlop domo at riddle.UUCP
Sat Sep 17 02:57:37 AEST 1988


In article <486 at poseidon.UUCP> ech at poseidon.UUCP (XT1554000-Edward C Horvath;LZ 3F-315;3005) writes:
>In article <990 at acornrc.UUCP> bob at acornrc.UUCP (Bob Weissman) writes:
>>The CC script which runs the AT&T C++ compiler makes reference
>>to a program called "cut", which does not exist on BSD systems.
>
>'cut' selects character-columns (-c) or tab-separated fields (-f) from the
>named files or stdin, and copies the result to stdout.  e.g.
>echo "How are you today" | cut -d" " -f1,3
>will yield "How you". (the -d overrides the separator character).
>
>More details: see any AT&T Unix User's Manual.

Quick hack fix: echo "How are you today" | awk -d" " '{print $1 " " $3}'

More details: see any UNIX User's manual from any source whatever.

With a little shell hacking, you could probably write a shell script called
cut that made awk look enough like cut to fool the BSD compiler.
Volunteers?

And yes, awk can correctly do database projection if that's what you need.
(I speak as one who squeezes reports out of relational databases by using
SQL followed by awk followed by troff.  In exceptional cases, I've had awk
write a shell script which, on being interpreted, drives troff...)  (But
you don't want to hear about my embarrassing databation habit, do you?)

It's my experience that all UN*X systems now provide awk at no extra cost --
although you may have to install a few modules above and beyond the
minimal ``runtime system'' (or whatever the supplier calls it) in order to
get it onto the system.  (In the bad old days, you had to pay extra in
order to get it on some machines -- boo, hiss.)

It is left as an exercise for the reader to perform the operation above
using sed.  Clue: it ain't pretty...
-- 
Dominic Dunlop
domo at sphinx.co.uk  domo at riddle.uucp



More information about the Comp.unix.questions mailing list