Reputation: 255
File list contains a few thousands filenames like:
./folder/folder/file.ext
For each item of the list I should edit a file: substitute text pattern "old_text_pattern" by "new_text_pattern". This command:
cat filelist | while read line; do sed -i 's/END_CREDIT_END/END_CREDIT/g' "$line"; done
gives an error:
sed: 1: "./folder ...": invalid command code .
How to perform the substitution properly? Thanks.
Upvotes: 0
Views: 47
Reputation: 123460
OS X sed -i
is not like GNU sed -i
. OS X's requires an argument.
cat filelist | while IFS= read -r line
do sed -i bak 's/END_CREDIT_END/END_CREDIT/g' "$line"
done
Upvotes: 1