I have multiple files and want to add a character at the beginning of filename, add extension, and remove a word in the center of the filename at once using single command and I run this using bash. Here are my files:
DATA_20210301_INPUT_CHECK
DATA_20210302_INPUT_CHECK
DATA_20210303_INPUT_CHECK
DATA_20210304_INPUT_CHECK
And want to rename them (in one operation) to :
1_DATA_20210301_CHECK.DAT
1_DATA_20210302_CHECK.DAT
1_DATA_20210303_CHECK.DAT
1_DATA_20210304_CHECK.DAT
How to change all the files name at once with single command? From what I do right know is do all this loop one by one
for f in *; do mv "$f" "$f.DAT"; done
for i in *; do mv "$i" 1_"$i"; done
for i in *; do mv "${i}" "${i//\_INPUT/}"; done
Please help me, thank you!
do mv "$f" "1_${f/_INPUT/}.DAT";
?