Renaming files that contain different numbers using rename command-Linux

Renaming files that contain different numbers using rename command-Linux

1

I have multiple files that have the following format: (note that file corresponds to each file name which is not common).

File1_S20.tab
File2_S25.tab
File3_S40.tab

etc

I want to rename them all so they become:

File1
File2
File3

etc

Basically removing the _S$$.tab part from all the files.

For renaming files, I usually use the rename command as follows: rename # somethingelse *.tab (replace # by somethingelse). But the only trouble I’m have is each file has different number after the S.


linux


coding

• 43 views

Read more here: Source link