I want to ask 2 questions about sed.
For example, when I try to put a string to sed which contains special character like (.\n*.+) and sed cannot run properly.
set a = ".\n*.\+"
set input = ".\n*.\+adsdfasdf"
Then execute:
echo "$input" | sed 's/'$a'/hi/g' # It will give: sed: No match
but
echo "$input" | sed "s#${a}#hi#g" # It will run but not true
My questions are:
- What is the difference between these commands: sed 's///' and sed "s###"
- How to treat input just as it is purely string?