Computing.Net > Forums > Unix > Creating a sed file

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Creating a sed file

Reply to Message Icon

Name: nmf
Date: February 7, 2004 at 16:25:31 Pacific
OS: unix/osx
CPU/Ram: mac G3 256 Ram
Comment:

I'm using the -f for the first time.
I'd like to use it for multiple replaces to clean a file
up.

This is the command line

sed -f clean.sed test > test.1

this is the sample clean.sed file
{
s/","/" "/g;
s/"."/" "/g;
}

The resulting test.1 file has no changes. What are
the requirements for the sed file.
Thanks



Sponsored Link
Ads by Google

Response Number 1
Name: Dlonra
Date: February 8, 2004 at 08:02:01 Pacific
Reply:


works for me - thanks for the sed lesson
whats in the file?


0

Response Number 2
Name: Jim Boothe
Date: February 9, 2004 at 07:47:56 Pacific
Reply:

The slashes delimit the string you want to find, so you don't want those double-quotes. The search string /"."/ is searching for a double-quote followed by any single character followed by another double-quote. The dot is a standard regexp wild character, so you need to precede it with a backslash for it to represent an actual dot. What you want is:

{
s/,/ /g
s/\./ /g
}


0

Response Number 3
Name: nmf
Date: February 9, 2004 at 12:32:11 Pacific
Reply:

Many thanks, it worked. I also noted that you
removed the ; at the end of each line.

Natalie


0

Response Number 4
Name: Jim Boothe
Date: February 10, 2004 at 10:29:24 Pacific
Reply:

Yes, your line breaks delimit each command. But if you want to combine multiple commands on one line, you can separate with the semicolons:

s/,/ /g ; s/\./ /g


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Unix Forum Home


Sponsored links

Ads by Google


Results for: Creating a sed file

How to create a file with extension www.computing.net/answers/unix/how-to-create-a-file-with-extension/7595.html

A simple script for creating a link www.computing.net/answers/unix/a-simple-script-for-creating-a-link/6981.html

Parsing and emailing a text file www.computing.net/answers/unix/parsing-and-emailing-a-text-file-/6623.html