[Eug-lug] help with directory listing
Jimmy Hendrix
jimmythedestroyer at gmail.com
Tue Mar 4 15:53:15 PST 2008
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 <rob at cogit8.org> 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 at euglug.org
> http://www.euglug.org/mailman/listinfo/euglug
>
More information about the EUGLUG
mailing list