LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 03-25-2005, 02:28 PM   #1
jango77
LQ Newbie
 
Registered: Mar 2005
Posts: 2

Rep: Reputation: 0
Filename string manipulation


Guys,

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.

Thanks
 
Old 03-25-2005, 02:35 PM   #2
saravkrish
Member
 
Registered: Mar 2004
Location: KY, USA
Distribution: Fedora Core 1
Posts: 190

Rep: Reputation: 30
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?

-Sarav
 
Old 03-27-2005, 06:58 PM   #3
jango77
LQ Newbie
 
Registered: Mar 2005
Posts: 2

Original Poster
Rep: Reputation: 0
Filename String Manipulation

Sarav,

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


Thanks
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
change uploaded files from filename.avi to filename.avi.html like www.rapidshare.de latheesan Linux - Newbie 3 06-16-2005 04:33 AM
bash + string manipulation dave bean Programming 7 02-16-2005 11:16 AM
String manipulation with a script. philipina Programming 4 03-16-2004 02:42 PM
String manipulation with a script? philipina General 1 03-15-2004 12:07 PM
java test if string in string array is null. exodist Programming 3 02-21-2004 01:39 PM


All times are GMT -5. The time now is 03:58 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration