Re: Sort the file

From: Barry Margolin (barmar_at_alum.mit.edu)
Date: 04/29/04


Date: Thu, 29 Apr 2004 02:25:40 -0400

In article <c6pn28$7up$1@pcls3.std.com>,
 demas@TheWorld.com (Charles Demas) wrote:

> untested
>
> grep -n infile | sort -k 2.1,2.1 1n | awk '{print $2}'

Aren't you missing an argument to grep -- the regexp? I guess you meant

grep -n '.*' infile | ...

But that seems like a strange way to do what "cat -n infile" can do.

-- 
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***


Relevant Pages

  • Re: [9fans] plan 9 regexp
    ... I am experimenting with some regexp implementations (namely the one ... operator in plan 9's grep: ...
    (comp.os.plan9)
  • Re: Deleting subset
    ... > IIRC POSIX says that regexps whose size are smaller than 256 bytes are OK. ... the grep solution is not as general as suggested: ... lines with Name in Reference but not in Archive ... using comm on those list of Names to know which are Extra or Missing. ...
    (comp.unix.shell)
  • Re: Post being ignored????
    ... That's strange too. ... I have gone to my sent box and resent the missing ... not common - but it can happen. ...
    (microsoft.public.windowsxp.general)
  • Re: piping multiple selections to mv or cp and exclusion
    ... and the regexp. ... allow me to use unix utilities on a corporate Windows machine doesn't ... back into the grep statement. ... expresion file. ...
    (comp.unix.shell)
  • Re: Extracting patterns from input
    ... Michael Stutz wrote: ... > This outputs only PATTERN from its input. ... (No, grep can't do that.) ... but you'd want the regexp tuned for the various utilities (since they ...
    (comp.unix.shell)