I have a script that finds all *.mvel files and replaces "D1000" with "D4000". But sed adds new line at the end. How could I avoid new line at the end of file?
Here is my script:
find . -name '*.mvel' -exec sed -i '' 's/D1000/D4000/g' '{}' \;
I have a script that finds all *.mvel files and replaces "D1000" with "D4000". But sed adds new line at the end. How could I avoid new line at the end of file?
Here is my script:
find . -name '*.mvel' -exec sed -i '' 's/D1000/D4000/g' '{}' \;
If you don't mind using perl
perl -pe 'chomp if eof' filename >filename2
is what I successfully tested to remove the ending \n on a file