Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!cbatt!ihnp4!cuae2!ltuxa!we53!sw013b!dj3b1!killer!ndmce!pollux!bobkat!pedz From: pedz@bobkat.UUCP (Pedz Thing) Newsgroups: net.unix Subject: Re: passing command line arguments to awk Message-ID: <125@bobkat.UUCP> Date: Wed, 24-Sep-86 11:00:27 EDT Article-I.D.: bobkat.125 Posted: Wed Sep 24 11:00:27 1986 Date-Received: Tue, 30-Sep-86 07:43:30 EDT References: <731@scc.UUCP> <7759@lanl.ARPA> Reply-To: pedz@bobkat.UUCP (Pedz Thing) Distribution: net Organization: Digital Lynx; Dallas, TX Lines: 36 In article <7759@lanl.ARPA> dph@a.UUCP (David P Huelsbeck) writes: >This is a special case but an important one. Using the -F option sets the >field separator to the character . This is important because setting the >field separator with: > > awk '{ print $3 }' FS=\":\" | sort -n -r > >will not set the FS variable to ":". (at least on 4.2) I haven't checked but >I suspect that it's caused by the fact that parameter values passed from the >command line are not made available until after the first record has been read >and parsed. Other variables not used in parsing (such as OFS etc.) may be set >in the way I've shown. In the case of RS I know of no way to set it from the >command line. > > dph@lanl.arpa Try: awk 'BEGIN { FS=":" } { print $3 }' | sort -n -r It works Wonders. (Not to mention that the FS="... is a pattern in this case and not a statement.) The is the end of the article I intended on posting but inews has the stupic feature that no article can have few original lines than quoted lines. In fact Pnews seems to have an additional feature of continual harassment whenever you try to post an article with it. I hate stupid things like this. They only provoke other stupid acts like this one of posting more garbage to the net than before. This is almost as dumb as the attempt to force net.announce to be shipped to all sites by rn refusing to work without it. Even if net.announce is shipped between sites (all sites) that is no guarantee that it will be read. -- Perry Smith ctvax ---\ megamax --- bobkat!pedz pollux---/