Rowena Ahia
Rowena Ahia

Reputation: 3

Batch renaming files on command line

I'm looking to rename a series of files that has the following naming system:

5901_fig-1658008.20.peg.1782.faa
7274_fig-1658008.20.peg.2807.faa
8228_fig-1658008.20.peg.3705.faa

And change it to:

fig-1658008.20.peg.1782.faa
fig-1658008.20.peg.2807.faa
fig-1658008.20.peg.3705.faa

How would I do this on command line?

Upvotes: 0

Views: 47

Answers (1)

jxc
jxc

Reputation: 13998

it looks like you just want to remove the sub strings before '_'

 for file in *.faa; do mv "$file" "${file#*_}"; done

Upvotes: 1

Related Questions