The Linux Community Forum

Support => General Help & Advice => Topic started by: Sophia on July 13, 2010, 10:33:37 pm

Title: Bash script problem with sed
Post by: Sophia on July 13, 2010, 10:33:37 pm
K, I tried to make a script to take a plain text file, replace it with a new txt file in which:
1. Every line begins with printf("
2. Every line ends with \n");
3. Every " is escaped
4. Every \ is escaped

It works except for the escaping of \. I am getting the error: sed: -e expression #1, char 8: unterminated `s' command

The relevant line is at the moment:
sed -i 's:\:\\:g' 1.txt
What am I doing wrong? (I tried also 's:\\:\\\:g')
:wq

LOL nevermind I just needed s:\\:\\\\:g
SimplePortal 2.3.3 © 2008-2010, SimplePortal