Author Topic: Bash script problem with sed  (Read 1530 times)

0 Members and 1 Guest are viewing this topic.

Offline Sophia

  • Jr. Member
  • **
  • Posts: 72
  • Karma: 0
  • I've just joined!
    • View Profile
    • Awards
Bash script problem with sed
« 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
« Last Edit: July 13, 2010, 10:49:07 pm by Sophia »

 


SimplePortal 2.3.3 © 2008-2010, SimplePortal