October 29, 2013

using find command for multiple files and then manipulating the results

Hello. I am new here. I have Linux experience but it is fairly limited. I have been trying to find a solution to the following problem:

I have a directory that contains multiple files. First, I need to find all files with an extension of ".trg" I have successfully done this using the find command:

param=`find *${file_name}*.trg`

this provides me with two filenames in the param variable:

ABC1099C.trg ABC1099R.trg

I need to take the text prior to the .trg (so ABC1099 from the first occurrence) and then find the associated filename with a .dat extension.

I tried using string operators but was unsuccessful. Maybe I should be using some kind of array processing?

Ideas?

Any help would be greatly appreciated.

THANKS

Click Here!