Re: Sort files by filename
- From: "Mark Haney" <mhaney@xxxxxxxxxxxxxxxx>
- Date: Tue, 31 Jul 2007 11:08:44 -0400
Miner, Jonathan W (CSC) (US SSA) wrote:
------------------------------
Try this to start out...
#!/bin/sh
last_seq_number=UNKNOWN
for f in `ls XXXX*bz2`; do
seq_number=`echo $f | cut -d'_' -f4 | cut -d'.' -f1`
if [ $last_seq_number != 'UNKNOWN' ]; then
diff=`expr $seq_number - $last_seq_number`
if [ $diff -ne 1 ]; then
echo "Missing Files"
fi
fi
last_seq_number=$seq_number
done
Man that is really close. However, and the one thing I neglected was that the filenames have different names before the last 2 digits:
XXXX20070515_112011_942_10.bz2 and in the same directory there may be:
XXXX20070515_112011_943_10.bz2
I'm not interested in the _###_ values, just the last 2 digits. Is there a way to build that in?
--
Recedite, plebes! Gero rem imperialem!
Mark Haney
Sr. Systems Administrator
ERC Broadband
(828) 350-2415
Call (866) ERC-7110 for after hours support
--
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)
- Sort files by filename
- Prev by Date: Back Again
- Next by Date: Re: Back Again
- Previous by thread: RE: Sort files by filename
- Next by thread: RE: Sort files by filename
- Index(es):
Relevant Pages
- Re: Sort files by filename
... radar site, the 8 digits after that is the date followed by '_HHMMSS_' ... last
2 digits are the part number of a complete scan. ... but a couple have reported missing
files. ... The rsync command should ensure that all ... (Fedora) - Re: Sort files by filename
... The next part I'm not certain, but believe it's the scan number of that particular radar
scan, then the last 2 digits are the part number of a complete scan. ... Our customers
get fed this data through our servers, but a couple have reported missing files. ... The
files are stored in directories in this format: XXXX/date/ so I have multiple volume scans in
each day's directory. ... (Fedora) - Re: case statement to validate input
... >I'm expecting input to be a char followed by up to 7 chars or digits. ...
There is no closing bracket to delimit the case pattern but more ... *) echo "Correct
Input";; ... (comp.unix.shell) - Re: bash scripting question
... both 'echo' and 'printf' put their results on standard out. ... the line where
you increment lab_num can also be simpler. ... In bash the $) alone on a line will
replace itself with the result ... Since you're using bash, you may also find it convenient to
put your hex digits into an array, which you can then subscript into with decimal numbers, to
build the hex values needed to print other characters. ... (Debian-User) - Newlines dropped? Despite double quotes?
... Why does this put the digits all on one line, ... Shouldn't they be separated
by a newline (with an initial ... I tried it with $(echo) too - same result. ...
$ bash --version ... (comp.unix.shell)