Re: Sort the file
From: Barry Margolin (barmar_at_alum.mit.edu)
Date: 04/30/04
- Previous message: rakesh sharma: "Re: RE pattern fetch"
- In reply to: Chris F.A. Johnson: "Re: Sort the file"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Fri, 30 Apr 2004 00:11:45 -0400
In article <c6scck$fj3gh$1@ID-210011.news.uni-berlin.de>,
"Chris F.A. Johnson" <c.fa.johnson@rogers.com> wrote:
> On 2004-04-29, Piyush Bichhoriya wrote:
> > Hi there
> > I'am new here and could use some help
> > I have one file
> >
> > L310
> > L400
> > L311
> > L401
> > H4
> >
> > and i want to sort on first character only to
> >
> > H4
> > L310
> > L400
> > L311
> > L401
> >
> > I tried many options in sort but nothing is working.
> > What i need actually to move last line to top without changing the
> > order of other lines.
>
> As I pointed out in comp.lang.awk, you don't need sort:
>
> {
> tail -1 FILE
> sed '$d' FILE
> } > NEWFILE
That will work for the special case of the example file he posted. My
guess is that he needs a more general solution, where the line that
needs to be moved is not always the last line.
-- Barry Margolin, barmar@alum.mit.edu Arlington, MA *** PLEASE post questions in newsgroups, not directly to me ***
- Previous message: rakesh sharma: "Re: RE pattern fetch"
- In reply to: Chris F.A. Johnson: "Re: Sort the file"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|