Hi,
Iam doing the following using sed in a script , it is NOT working
line_old= 3754|Yes|Yes
line_new= 3754|Yes|Yes|Yes|Yes
sed -e 's/$line_old/$line_new/' data.$$ > tmp.$$
mv tmp.$$ data.$$
Regards
Hi,
Iam doing the following using sed in a script , it is NOT working
line_old= 3754|Yes|Yes
line_new= 3754|Yes|Yes|Yes|Yes
sed -e 's/$line_old/$line_new/' data.$$ > tmp.$$
mv tmp.$$ data.$$
Regards
Drop the single quotes and introduce double quotes.
Vino,
It was an interesting thing to know about, can you pls explain the logic behind.
Regards,
Tayyab
It worked thanks
See the section QUOTING under man sh. Its too big to quote here. But this is what you are looking for..
Enclosing characters in double quotes preserves the literal value of
all characters within the quotes, with the exception of $, `, and \.
The characters $ and ` retain their special meaning within double
quotes. The backslash retains its special meaning only when followed
by one of the following characters: $, `, ", \, or <newline>. A double
quote may be quoted within double quotes by preceding it with a back-
slash.
Vino, thanks for your reply. I know a double quote is used to preserve the literal value of characters, thing of interest was difference between single and double quote.