Re: Sorting only certain data in file.
From: Dave Gibson (dave+news001_at_gibson-hrd.abelgratis.co.uk.invalid)
Date: 02/17/05
- Next message: Kevin Rodgers: "Re: Help on Changing user and executing commands using shell script"
- Previous message: Ed Morton: "Re: Alternatives to perl in-place edit"
- In reply to: TB: "Sorting only certain data in file."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Thu, 17 Feb 2005 19:41:33 +0000
TB <chessgame@gmail.com> wrote:
[snip]
> Below is an example of what I have. Basically I need everything
> between the ### and the ------------------------ sorted, while
> maintaining the other parts so I know what server, day, and hour the
> data is for. (in the real file there are hundreds of users).
[snip]
> ------------------------
> edgar
> Mon Feb 14 20:00:36 CST 2005
>
> ###
> buckt :0 Nov 10 16:21
> buckt pts/1 Feb 14 21:39 (192.168.0.117)
>
> ------------------------
> ------------------------
> edgar
> Mon Feb 14 21:00:22 CST 2005
>
> ###
> buckt :0 Nov 10 16:21
> buckt pts/1 Feb 14 21:39 (192.168.0.117)
>
> ------------------------
printf 'g/^###$/+1,/^--*$/-1!sort\nw\nq\n' | ex -s yourfile
- Next message: Kevin Rodgers: "Re: Help on Changing user and executing commands using shell script"
- Previous message: Ed Morton: "Re: Alternatives to perl in-place edit"
- In reply to: TB: "Sorting only certain data in file."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|