Linux search and replace in multiple files
So, I needed a little tool to perform search and replace on multiple files in a Linux environment. Here's how I did it:
#!/bin/sh
for file in *; do
mv $file $file.old
sed 's/FINDSTRING/REPLACESTRING/g' $file.old > $file
rm -f $file.old
done


0 Comments:
Post a Comment
<< Home