Xref: utzoo comp.lang.c++:1621 comp.unix.questions:9251 comp.sources.wanted:5059 Path: utzoo!attcan!uunet!mcvax!ukc!reading!riddle!domo From: domo@riddle.UUCP (Dominic Dunlop) Newsgroups: comp.lang.c++,comp.unix.questions,comp.sources.wanted Subject: Re: "cut" needed to run CC Summary: can use awk as substitute for cut Message-ID: <911@riddle.UUCP> Date: 16 Sep 88 16:57:37 GMT References: <990@acornrc.UUCP> <486@poseidon.UUCP> Reply-To: domo@riddle.UUCP (Dominic Dunlop) Organization: Sphinx Ltd., Maidenhead, England Lines: 37 In article <486@poseidon.UUCP> ech@poseidon.UUCP (XT1554000-Edward C Horvath;LZ 3F-315;3005) writes: >In article <990@acornrc.UUCP> bob@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@sphinx.co.uk domo@riddle.uucp