Last active
July 8, 2023 15:12
-
-
Save F1LT3R/b5c8d2f040cdbd5a246b12b9912b48f7 to your computer and use it in GitHub Desktop.
Batch rename files in Linux with "for" and "sed"
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For a list of files like this... | |
# eng-web_002_GEN_01_read.txt | |
# eng-web_096_REV_22_read.txt | |
# Batch rename removing "eng-web_" and "_read"... | |
for i in *; do mv ${i} $(echo ${i} | sed 's/eng-web_//;s/_read//'); done | |
# Result is file list like this... | |
# 002_GEN_01.txt | |
# 096_REV_22.txt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment