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' '{}' \; 
3
  • To be honest, I do not know the syntax. I would be very grateful if someone will tell me how to do it. Commented Aug 20, 2012 at 12:46
  • stackoverflow.com/questions/1654021/… Commented Aug 20, 2012 at 12:59
  • Stephane thank you! But could you show the final solution? Commented Aug 20, 2012 at 13:03

1 Answer 1

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

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.