Shinobii
Shinobii

Reputation: 2561

Call partial file name in a linux script

I have several files: one_001_three.txt, one_002_three.txt, . . .

After removing the extension, I would like to call it such that:

    ${fname}_001

would call the file 'one_001'

Any ideas?

Upvotes: 0

Views: 120

Answers (2)

Praveen
Praveen

Reputation: 235

As far as i understood your Question ..

you can use this command basename try with this and develop .

basename one_001_three.txt _three.txt -->this will give output as one_001 .

the filename doesnt get changed though

Upvotes: 0

pravin_23
pravin_23

Reputation: 126

As far as i understood your Question ..

yu can use this command basename try with this and develop .

basename one_001_three.txt _three.txt -->this will give output as one_001 .

the filename doesnt get changed though .

Upvotes: 2

Related Questions