Hi all,
I have several files with the same extension name(*.txt). I want to have
copy of these files by attaching a suffix to each of the files. Example
test1.txt should be copied to test1_new.txt. The suffix to be added in all
files is the same. I tried using this but did not work.
ls *.txt | xargs -I {} cp {} {}_new.txt
test.txt should be test_new.txt
but I got test.txt_new.txt
what should I do to make work?
for file in *.txt
do
cp "$file" "${file/.txt/_new.txt}"
done
--
Chris F.A. Johnson, <http://cfajohnson.com>