regex - Using sed to add character -



regex - Using sed to add character -

this question has reply here:

how add together text @ end of each line in unix 3 answers

i working on adding character @ end of line big file. each line has 3 octets of ip network, ending in period , line feed (\n). working in cygwin.

i.e.

10.23.34.

23.34.45.

i attempting utilize sed work me; i've tried next 2 commands no success:

sed 's/\n/1\n/' <filename> sed 's/\n/1\n/g' <filename> sed 's/(.*)/${1}1/' <filename>

i have gotten work in perl perl -pe 's/(.*\.)/${1}1/' <filename>

what doing wrong please?

thank you

add foo @ end of every line:

sed 's/$/foo/' filename > new_filename

replace in place:

sed -i 's/$/foo/' filename

regex perl sed cygwin

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -