Sed script help

This forum allows you to share scripts with other Zeus users. Please do not post bug reports, feature requests or questions to this forum, but rather use it exclusively for posting scripts or for the discussion of scripts that have been posted.
Post Reply
Phil Hansen
Posts: 7
Joined: Thu Nov 15, 2007 1:02 pm

Sed script help

Post by Phil Hansen » Thu Nov 15, 2007 1:21 pm

Hi,
Hope this the right forum.
Some time back Jussi helped with a script for deleting HTML tags. Worked fine.
Now have a problem removing the " character from a text file. Tried Sed and modifying the original script but could not get it to remove the offending ".
Eventually used the search and replace but it took 6 hours to find and replace 2500000 instances of " with a blank.
There must be a faster way.
This is to be done every month so any help in speeding it up would be appreciated.
Thanks
Phil

jussij
Site Admin
Posts: 2432
Joined: Fri Aug 13, 2004 5:10 pm

Post by jussij » Thu Nov 15, 2007 10:15 pm

Hi Phil,
Tried Sed and modifying the original script but could not get it to remove the offending "
The s/\"/ /g command should work.

For example, given this file data:

Code: Select all

This"is"a"test"string
This"is"a"test"string
This"is"a"test"string
This"is"a"test"string
This"is"a"test"string
Running this sed command:

Code: Select all

sed "s/\"/ /g" test.txt
produces this result:

Code: Select all

This is a test string
This is a test string
This is a test string
This is a test string
This is a test string
Cheers Jussi

Phil Hansen
Posts: 7
Joined: Thu Nov 15, 2007 1:02 pm

Post by Phil Hansen » Fri Nov 16, 2007 4:51 am

Hi Jussi,
Thanks for that. Works fine.
I tried /"/, ["], '"' but not \"/.
Got it working from the tools menu and fixes the file in about 30 secs.
Big difference from search and replace.
Thanks again :D

Cheers
Phil

Post Reply
kuchnie warszawa opinie

Who is online

Users browsing this forum: No registered users and 1 guest