Re: Script help

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Sep 19, 2008 at 2:18 PM, James Pifer <jep@xxxxxxxxxxxxxxxx> wrote:
> On Fri, 2008-09-19 at 13:50 -0700, Mike Wright wrote:
>> James Pifer wrote:
>> > I've been googling to find ways of doing this but I'm not finding
>> what
>> > I'm looking for. I think this should be fairly easy, so I'm hoping a
>> > script guru out there can tell me what I need.
>> >
>> > I have some files that are all named like:
>> > myfile387465893495643658734.txt
>> > myfile547647453645635632454.txt
>> > myfile563546356243546767546.txt
>> > myfile465565634678567345656.txt
>> > myfile456674567452345566345.txt
>> >
>> > I need to find all files that start with 'myfile', end in .txt Then
>> I
>> > need to find the most recent version and use it in a command.
>> >
>> > Can anyone rattle this off of the top of their head?
>>
>> `ls -t myfile*.txt | head -1` might work for you.
>
> Did a couple tests. I think that will work. Thanks a lot!
>
> James
>
> --
> fedora-list mailing list
> fedora-list@xxxxxxxxxx
> To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
> Guidelines: http://fedoraproject.org/wiki/Communicate/MailingListGuidelines
>

Just another way:
You can also use the find command if the file you're looking for
is elsewhere: "find <whereToLook> <pattern> -cmin 30".
The -cmin finds files modified the last 30min.
The -ctime option find files modified a number of hours ago.
It's in the 'find' man page.

~af

~af

-- 
fedora-list mailing list
fedora-list@xxxxxxxxxx
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
Guidelines: http://fedoraproject.org/wiki/Communicate/MailingListGuidelines
[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [Fedora Magazine]     [Fedora News]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Maintainers]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Legacy]     [Fedora Desktop]     [Fedora Fonts]     [ATA RAID]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [SSH]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Centos]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Tux]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Asterisk PBX]     [Fedora Sparc]     [Fedora Universal Network Connector]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux