Re: Sort files by filename



Rodolfo Alcazar Portillo wrote:
Am Dienstag, den 31.07.2007, 11:00 -0400 schrieb Miner, Jonathan W (CSC)
(US SSA):
-----Original Message-----
From: fedora-list-bounces@xxxxxxxxxx on behalf of Mark Haney
Sent: Tue 07/31/2007 10:52 AM
To: For users of Fedora
Cc:
Subject: Sort files by filename

This is really a general linux question. I have a series of files in a format like this:

XXXX20070515_112011_942_10.bz2
XXXX20070515_112011_942_12.bz2 etc,

and I am trying to find a way to do 2 things, one, sort these files in order, and then once in order, find the files that are numerically missing based on the last 2 numbers in the file name. So if I have (as above I want to know that file XXXX20070515_112011_942_11.bz2 is missing. Can someone get me started on this, I'm stumped.

Just an example tip which simply works with a counter, hope helps you.

a) Do you really need the sorting stuff? I didnt mess with that.

b) the counter:

[rodolfoap] /home/rodolfoap > for n in $(seq 10 40); do touch XXXX20070515_112011_942_${n}.bz2; done
[rodolfoap] /home/rodolfoap > rm XXXX20070515_112011_942_11.bz2 [rodolfoap] /home/rodolfoap > rm XXXX20070515_112011_942_22.bz2 [rodolfoap] /home/rodolfoap > rm XXXX20070515_112011_942_33.bz2 [rodolfoap] /home/rodolfoap > for n in $(seq 10 40); do if [ ! -e *_${n}.bz2 ]; then echo NOT FOUND: $n; fi; done
NOT FOUND: 11
NOT FOUND: 22
NOT FOUND: 33
[rodolfoap] /home/rodolfoap >

Good luck.

I think this would probably work except I really need to know which ones are out of sequence as is, changing the filename would eliminate that capability and the missing files are the ones I need. See, I'm receiving the files from a separate server and they are sent to me in this format. I need to know which ones I /don't/ receive so I know which ones I need to have resent. Make sense?



--
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



Relevant Pages

  • Re: Sort files by filename
    ... Subject: Sort files by filename ... missing based on the last 2 numbers in the file name. ... this format. ...
    (Fedora)
  • RE: Sort files by filename
    ... Subject: Sort files by filename ... This is really a general linux question. ... format like this: ... missing based on the last 2 numbers in the file name. ...
    (Fedora)
  • RE: Sort files by filename
    ... Subject: Sort files by filename ... This is really a general linux question. ... format like this: ... missing based on the last 2 numbers in the file name. ...
    (Fedora)
  • Re: auto copy text in word to another text field in word
    ... The other way is to format the 'R' in each of the REF fields with the font attributes you want and apply a CHARFORMAT switch to the fields, ... So I turned off the automatic bold component ... followed by the 'correct' bookmark name after the the double quote following the filename. ... Make a copy of the INCLUDETEXT field, press Shift-F9 to expose the field code and change the bookmark name to another of the ...
    (microsoft.public.word.newusers)
  • Re: fixed length file to excel? VBA macro possible?
    ... Tom was pointing out that Excel expects every row to be the same, ... Because i need to format the lines that start with say 02 differently ... Dim FileName As String ...
    (microsoft.public.excel.programming)