Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!wuarchive!emory!gatech!prism!romeo!rhoward From: rhoward@msd.gatech.edu (Robert L. Howard) Newsgroups: comp.unix.questions Subject: Re: How to add line numbers to a text file? Message-ID: Date: 30 Nov 90 19:34:51 GMT References: <6826@uceng.UC.EDU> <15248:Nov3018:01:4490@kramden.acf.nyu.edu> Sender: news@prism.gatech.EDU Organization: Georgia Tech Research Institute Lines: 28 In <15248:Nov3018:01:4490@kramden.acf.nyu.edu> brnstnd@kramden.acf.nyu.edu (Dan Bernstein) writes: >In article <6826@uceng.UC.EDU> dmocsny@minerva.che.uc.edu (Daniel Mocsny) writes: >> My question to all of you, however, is this: faced with the need to >> number a text file from a shell script, how would you do it? I'm >> kind of curious to see the variety of approaches possible. Would you >> use C, awk, perl, sed, sh, cat, echo, expr, and/or dd? >grep -n .* Huh? This is not even a complete answer.... Try: cat -n outfile (It's got to be faster than grep too) Robert -- | Robert L. Howard | Georgia Tech Research Institute | | rhoward@msd.gatech.edu | MATD Laboratory | | (404) 528-7165 | Atlanta, Georgia 30332 | | UUCP: ...!{allegra,amd,hplabs,ut-ngp}!gatech!msd!rhoward | ------------------------------------------------------------------------- | "They [La Prensa] accused us of suppressing freedom of | | expression. This was a lie and we could not let them | | publish it." -- Nelba Blandon, Director of Censorship |