![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| finding difference between 2 directory recursively | yayati | Shell Programming and Scripting | 2 | 04-09-2008 07:37 AM |
| Finding the oldest file in a particular directory | pavan_movva | Shell Programming and Scripting | 2 | 10-07-2006 02:17 AM |
| Finding largest file in current directory? | AusTex | High Level Programming | 1 | 03-13-2005 10:03 AM |
| finding file in a directory | legato | UNIX for Dummies Questions & Answers | 4 | 01-24-2005 08:27 PM |
| Finding users currently accesing a directory | mehtad | Shell Programming and Scripting | 3 | 11-29-2001 12:34 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Finding the lowest sequenced file in a directory?
Hello,
I have three files in a directory: 1_700_123456.lst 1_701_123456.lst 1_702_123456.lst I am trying to use a command via ksh that will list the file that has the lowest number in the second node and put that to a file. In the example above, it would put 1_700_123456.lst in a file. Any ideas on how to do this easily? Thanks! |
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
Code:
ls -l | sort -t_ -nk2,2 | head -1 |
|
#3
|
|||
|
|||
|
Try something like this:
Code:
awk -F"_" '!m || $2<m{m=$2;s=$0}END{print s}' file
|
|||
| Google The UNIX and Linux Forums |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|