: this is what i tryed on the command prompt.
: 
: perl -pi -e 's{^<!--\n<td>}{test}' hello.txt
:   
: but this command is not working .. so anybody kindly please help me in getting a 
:regular expression for this.

Two things:

1. The -p flag by itself will only read in one line of hello.txt at a time.
   Use -0777 (that's "dash zero" followed by 777) to make perl slurp up the whole
   file as a single string.

2. Use the "s" modifier to treat the slurped-up file as a single string.

So the command would look like this:

perl -0777 -pi -e 's{^<!--\n<td>}{test}s' hello.txt

(I would also change -i to -i.bak so you have a backup copy of the
original file.)

-- tdk

Reply via email to