Re: Sort files by filename
- From: "Mikkel L. Ellertson" <mikkel@xxxxxxxxxxxxxxxx>
- Date: Tue, 31 Jul 2007 16:37:22 -0500
Les Mikesell wrote:
Mark Haney wrote:
^^^^^^^^^^^^count=xx
for i in $(ls <something>* | sort) ; do
The |sort isn't necessary since the shell always returns wild-card
expansions in sorted order. In fact the ls isn't necessary either since
the shell has already generated the list.
You are correct, it is not be necessary in the example - I put it in
as an option if you were not sorting on the entire file name, but on
a specific field. You have more options on how you sort by piping
the list though sort. In this case, the -k or -M options may be handy.
for i in something*It will catch if the first file is missing - the first entry will be
will do the same thing.
file_num=$(cut --delimiter=_ -f1 $i)
while [ $count -lt $file_num ] ; do
echo Missing file number $count count++
done
done
This is great. I think now I have enough pieces to make something
work. I appreciate all the help.
The above doesn't help if you lose the 1st or last bunch of files. Do
you always get the same set every day?
greater then count. If you know in advance how many files there
should be, you could add a test to see if the last file is
xx+number, as well as using that as an exit for the while loop.
As I had stated in the comments after the script, it was not
intended as a finished solution, but as a starting point for
building something that fit data better.
Mikkel
--
Do not meddle in the affairs of dragons,
for thou art crunchy and taste good with Ketchup!
Attachment:
signature.asc
Description: OpenPGP digital signature
fedora-list mailing list
fedora-list@xxxxxxxxxx
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
- References:
- Sort files by filename
- From: Mark Haney
- RE: Sort files by filename
- From: Miner, Jonathan W (CSC) (US SSA)
- RE: Sort files by filename
- From: Rodolfo Alcazar Portillo
- Re: Sort files by filename
- From: Mark Haney
- Re: Sort files by filename
- From: Kam Leo
- Re: Sort files by filename
- From: Mark Haney
- Re: Sort files by filename
- From: Les Mikesell
- Re: Sort files by filename
- From: Mark Haney
- Re: Sort files by filename
- From: Mikkel L. Ellertson
- Re: Sort files by filename
- From: Mark Haney
- Re: Sort files by filename
- From: Les Mikesell
- Sort files by filename
- Prev by Date: Re: Sort files by filename
- Next by Date: Re: Sort files by filename
- Previous by thread: Re: Sort files by filename
- Next by thread: Re: Sort files by filename
- Index(es):
Relevant Pages
- Re: sort + head = weirdness?
... >'sort'and then through 'head' and I'm getting really strange results. ...
>works fine with 'sort' itself. ... buffer, so there's no attempt to write anything
after "head" has exited. ... Check the documentation of the shell (you didn't say what
shell you're ... (comp.unix.shell) - Re: hc11 program help
... >saw reference to it for the first time in a Byte magazine article. ... one
should say Shell sort. ... >bubble sort with similar technique applied, it's a comb
sort. ... (comp.arch.embedded) - Re: how do i change the default sort of the media player
... Sort order in the shell doesn't matter at all. ... then right click and
select play. ... (microsoft.public.windowsmedia.player) - Re: sorting after a rename of a listviewitem in a listview control
... Another way would be to start a timer in the AfterLableEdit handler and call
... the Sort method when the timer is fired. ... Shell MegaPack: GUI Controls
For Drop-In Windows Explorer like Shell ... (microsoft.public.dotnet.framework.windowsforms.controls) - Re: Ford Ranger-Update
... This one is closed ended glass but no pass through..which I may have ... And
the inside of the shell has some sort of sound deadner ... went to Horrible Freight
and bought soft sided tool bags for specific ... (rec.crafts.metalworking)