This is a test version of Biostars. For the public version, visit https://www.biostars.org.
How I can change many names of list file

Hi, Please help me, I have a list file(.txt) in shell, like :1a.adjust, 2a.adjust, 3a.adjust...200a.adjust. How I can rename all of them, like 1a, 2a, 3a, 4a, ...200a

genome

I assume you want to actually changes the names of the files. Plenty of options in this thread from yesterday: changing the name of files

Hello hosein_salehi6!

There are already a couple of answers here and a recent thread linked above that has plenty of other options.

For this reason we have closed your question. This allows us to keep the site focused on the topics that the community can help with.

If you disagree please tell us why in a reply below, we'll be happy to talk about it.

Cheers!

$ rename.ul .adjust "" *.adjust

2 answers

Assuming that you want to modify the content of a .txt file, you can achieve that in many different ways, for example with sed:

sed -i -e 's/.adjust//g' your_file.txt

I think you can use:

for file in *.adjust
do
    mv -i "${file}" "${file/.adjust/}"
done

(Assuming they aren't in a txt file - in which case the given answer works a treat)

Log in to answer this question.