osx - Delete line ending with a newline character in text file -
i need delete same line in large number of text files. have been trying use sed, cannot delete newline character @ end. following deletes line, not newline:
sed -i -e 's/version:1//' *.txt
i have tried using following delete newline also, not work:
sed -i -e 's/version:1\n//' *.txt
is there anyway specify newline in sed substitute command or there other command line tool can use achieve goal? thank you
you can use sed
command:
sed -i -e '/version:1/d'
for this.
the following transcript gives example:
pax> echo 'hello > goodbye > hello again' | sed '/oo/d' hello hello again
you should check whether want match whole lines with, example:
sed -i -e '/^version:1$/d'
since, stands, delete lines following:
version:10 conversion:1
Comments
Post a Comment