while read line
do
//Each line is a file name
//After reading each line i want to replace substring .json with .jpeg and use it in the below cp command.
cp /mnt/ftp/xml/dd/ingest/new/processed/$line /mnt/ftp/xml/dd/ingest/JnJ-redo1
done < error_files.txt
答案 0 :(得分:1)
您可以使用Shell Parameter Expansion在此处执行操作。
while read line
do
cp /mnt/ftp/xml/dd/ingest/new/processed/"${line/.json/.jpeg}" /mnt/ftp/xml/dd/ingest/JnJ-redo1
done < error_files.txt