![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | 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 and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| sort text file | naamas03 | Shell Programming and Scripting | 4 | 08-04-2009 08:51 AM |
| egrep not giving desired results | igandu | Shell Programming and Scripting | 3 | 11-14-2007 04:43 AM |
| Perl Sort on Text File | eltinator | Shell Programming and Scripting | 6 | 08-07-2007 02:20 PM |
| Need a Help with sort a text file with some fields | alexcol | Shell Programming and Scripting | 3 | 02-19-2007 03:13 AM |
| How to sort find results | groundlevel | UNIX for Dummies Questions & Answers | 8 | 11-09-2005 02:36 AM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
HELP: I need to sort a text file in an uncommon manner, can't get desired results
Hi All
I have a flat text file. Each line in it contains a "/full path/filename". The last three columns are predictable, but directory depth of each line varies. I want to sort on the last three columns, starting from the last, 2nd last and 3rd last. In that order. The last three columns have a constant column width: Code:
/../...../.../2009/365/2300.Z 2nd Last col(3}: Day of Year, 001 -> 365 (366 in leap years) 3rd Last col(4): Year I'll explain with an example: - desired sort key: last col, 2nd last col, 3rd last col Example: (unsorted) Code:
cat dirList.txt /home/jake/quarterly/2009/307/1300.Z /home/jake/quarterly/2009/303/1400.Z /home/jake/bimonthly/submitted/2009/007/1800.Z /home/jake/yearly/2009/199/2300.Z Code:
cat dirList.txt | unix | magic | commands | here /home/jake/bimonthly/submitted/2009/007/1800.Z /home/jake/yearly/2009/199/2300.Z /home/jake/quarterly/2009/303/1400.Z /home/jake/quarterly/2009/307/1300.Z Any help would be greatly appreciated. Tks, Jake. Last edited by pludi; 3 Weeks Ago at 12:04 PM.. Reason: code tags, please... |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|