replaceing \n with -e \n
hi
am trying to replace "echo \n" as echo "echo -e \n" througout my script, which is not working as expected. my work around: :%s//n/-e /n/g :%s/"/n"/"-e /n"/g :%s/\/n/-e \/n/g :%s:\/n:-e \/n:g |
You say you want to replace '\n' but all of your examples are trying to replace '/n'. I would also suggest that most of your examples would error due to the excess of /'s
Based on your examples I presume you are performing the task inside vim and whilst it can be done there, sed would probably be cleaner as you can change the /// delimiter for another character to make it clear what you are doing. |
you can use the same command in vim (so you can use ! as delimiter in vim too)
|
Code:
s! \\n! -e \\n! |
Quote:
$ echo -e $(echo -e \n) or $ echo echo -e \\n Bash will interpret things before passing them to a command. Hence the double \ to maintain the single \ after interpretation. |
All times are GMT -5. The time now is 11:17 AM. |