I want to edit a huge script file using sed. How can I add the new lines symbols in the red colored places?
sed -e "s/test -z "$x"/if test -z "$x" then echo -1; \n else \n/g"
I want to edit a huge script file using sed. How can I add the new lines symbols in the red colored places?
sed -e "s/test -z "$x"/if test -z "$x" then echo -1; \n else \n/g"
You can do the work with awk :
awk "{ gsub(/test -z $x/, \"if & then echo -1; \n else \n\") ; print}"
Jean-Pierre.