Tuesday, 13 January 2009

Replacing text in files.

for file in m93acou10?.pyFE ; do

# test case: Run first, check screen output looks ok.
sed -e 's/splits:16/splits:32/g' "$file"

# Real case: Run only when sure all is well.
# sed -e 's/splits:16/splits:32/g' "$file" > tmp_file
# mv tmp_file "$file"

echo replaced in $file----------------------------------------------
done


from http://www.linuxforums.org/forum/linux-programming-scripting/39664-search-replace-text-within-several-files-2.html

No comments:

Post a Comment