Piping to:

head -n 1
or
tail -n 1

will get you the first and last line respectively.  Might be a better
way, but that should work.

Jimmy

On Tue, Mar 4, 2008 at 3:46 PM, Rob Hudson <[EMAIL PROTECTED]> wrote:
> I'll admit up front... I don't know my unix utility commands like I
>  should.  Thinks like sed, awk, cut, sort, uniq, etc can all make for
>  some powerful combinations.
>
>  My goal via a shell script: Get the filename of the most recently modified 
> file.
>
>  I can do this:
>  > ls -t
>
>  to get the files sorted by modified time.  But can you do a "LIMIT 1"
>  a la SQL, or just get the first line?  Or reverse sort it to get the
>  last line?
>
>  Thanks,
>  Rob
>  _______________________________________________
>  EUGLUG mailing list
>  euglug@euglug.org
>  http://www.euglug.org/mailman/listinfo/euglug
>
_______________________________________________
EUGLUG mailing list
euglug@euglug.org
http://www.euglug.org/mailman/listinfo/euglug

Reply via email to