LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Help with Bash Script - Rename Multiple Files (https://www.linuxquestions.org/questions/programming-9/help-with-bash-script-rename-multiple-files-347062/)

grail 04-02-2010 12:29 AM

Sorry my bad there, I was just checking I had the correct output, but the easy option is:

Code:

print | "mv \"" $0 "\" \"" out2 "\""

Olion 04-02-2010 03:50 AM

Hi,
one more solution:

Code:

$ ls -1
file1.txt
file2.txt
pic0001.esp
pic0002.esp

$ cat file1.txt
pic0001.esp
pic0002.esp
$

$ cat file2.txt
Sony
Red Cross
$

$ sed -i 's/.*/"&.esp"/' file2.txt
$ cat file2.txt
"Sony.esp"
"Red Cross.esp"
$

$ paste -d " " file1.txt file2.txt | sed 's/^/mv /' > change.sh; sh change.sh

$ ls
change.sh  file1.txt  file2.txt  Red Cross.esp  Sony.esp
$

Greeting
Oleg


All times are GMT -5. The time now is 01:29 PM.