3

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' '{}' \;
Eazy
  • 3,212
  • 5
  • 24
  • 40

1 Answers1

2

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

Stephane Rouberol
  • 4,286
  • 19
  • 18