@ygemici
Sorry for the late reply... i was trying a couple of other things too..
When i tried to grep with a file name what u said below works... but it doesnt work with a variable name. Were u able to successfully execute this ? Is infile considered like a variable name ?
# grep "'||chr(" infile -n|cut -d: -f1
grep "'||chr(" new.html -n |cut -d: -f1 > new1.html works fine.
Also i did - man grep and the syntax seems to accept only file name.
With SED (accepts file and pipeline inputs), i was able to use a variable name but it wasnt able to replace the last line.. instead it replaced all lines...
This is what i used ( also tried simple examples)
name=`echo $data | sed '$s/'\''||chr(10)||/ /g'`
Expectation:
$s would replace in the last line
replace '||chr(10)|| with blank
Note: in my file there are more than one line that has that string similar to your example.