-   Linux - Newbie (
-   -   Filename string manipulation (

jango77 03-25-2005 03:28 PM

Filename string manipulation

I am writing a KSH script which will parse two filenames and match the last two characters, e.g file1_22050325.04 & file2_20050325.04. If a pattern match is found, i.e. 04 with 04 in this case, the contents are to be matched based on record count in one file and a row count in the other file.
I tried awk but it is not straigtforward.

Would really appreciate it if someone out there could help me out.


saravkrish 03-25-2005 03:35 PM

Perl or awk would be the best. What do you want to do exactly? compare the last 2 characters of two given filenames?

Edit: I mean, which part are you not able to figure out?


jango77 03-27-2005 07:58 PM

Filename String Manipulation

The idea is to sort thru pairs of files and in a pair, one is a datafile and the other is a sentinel file which just has the Rec-count. I want to be able to loop thru the sets and do a checksum and rename the pair if it fails the checksum. The pair comes in at the same time and I can't do a ls -ltr to process it because it is likely I may not get the sentinel file every time and I have to account for it. The file extension of the pair is identical and that's what my script ought to be able to do.

Hope that helps...


All times are GMT -5. The time now is 05:33 AM.