![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| linux reverse page order+duplex is not working | uttamhoode | UNIX for Advanced & Expert Users | 0 | 06-02-2008 03:06 AM |
| reverse sort | markjason | Shell Programming and Scripting | 3 | 04-09-2007 06:37 PM |
| Stopping Start/Stop scripts in reverse order | madasafish | Shell Programming and Scripting | 1 | 08-05-2006 08:05 AM |
| Sort - original order .... Help | olga | UNIX for Dummies Questions & Answers | 2 | 06-01-2005 05:26 AM |
| using sed and regex to reverse order??? | urtherhoda | UNIX for Dummies Questions & Answers | 2 | 10-13-2004 07:57 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
sort a file in reverse order
I a file with log entries... I want to sort it so that the last line in the file is first and the first line is last..
eg. Sample file 1 h a f 8 6 After sort should look like 6 8 f a h 1 Is this possible? |
| Forum Sponsor | ||
|
|
|
#2
|
||||
|
||||
|
Code:
tail -r filename |
|
#3
|
|||
|
|||
|
Its always something simple ehh.. I was playing around with sort -r but that was doing too much sorting..
Thanks for that!!! |
|
#4
|
||||
|
||||
|
Yet another way.
The actual sample file. Code:
$ cat sample.file 1 h a f 8 6 Code:
$ tac sample.file 6 8 f a h 1 |
|
#5
|
|||
|
|||
|
I think its better to use sort itself...
sort -r <filename> I didn't c an option " -r " with tail... |
|
#6
|
||||
|
||||
|
hey vino,
tac is not available under solaris 5.8 rishi |
|
#7
|
|||
|
|||
|
And as RishiPahuja has told, tail also works but with -n option
Code : tail -n filename |
|||
| Google The UNIX and Linux Forums |