I've a filename of this format: "XXX_XXX_TXT.TAR.AS". Need to change the name into this format: "XXX_XXX.TAR.AS". This file resides in a directory. I'm ok with using the find command to search and display it.
Essentially I just need to replace the string "_TXT.TAR.AS" to ".TAR.AS". Is awk or sed the way to do it?
I've a filename of this format: "XXX_XXX_TXT.TAR.AS". Need to change the name into this format: "XXX_XXX.TAR.AS". This file resides in a directory. I'm ok with using the find command to search and display it.
Essentially I just need to replace the string "_TXT.TAR.AS" to ".TAR.AS". Is awk or sed the way to do it?
Thanks.[/QUOTE
first do a find and store the files in a new file. Loop it and inside loop do this.
sed 's/XXX_XXX_TXT.TAR.AS/XXX_XXX.TAR.AS/' filename
The values XXX_XXX are actually timestamp dynamically generated, hence I do not know them in advance. How would I be able to combine with the find command to achieve this?
We can't guess from a single filename how to generalize for your particular situation, but the above should work for anything with a single number in the middle.