LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 04-20-2002, 10:55 PM   #1
kwigibo
Member
 
Registered: Apr 2002
Posts: 53

Rep: Reputation: 15
sed


EDIT:

Hi, I've changed the whole post because I fixed the problem, but Im still stumped on another part of sed.

How do you replace a character with a newline character?

I need to replace colons with newlines.

kwigibo

Last edited by kwigibo; 04-21-2002 at 02:10 AM.
 
Old 04-21-2002, 03:23 PM   #2
ngomong
Member
 
Registered: Apr 2002
Posts: 54

Rep: Reputation: 15
Just a suggestion:

When you ask a question and solve the problem... you should leave your post intact, and hopefully post how you solved it. Lots of us out here are learning from each other's solutions.

Thanks!
 
Old 04-21-2002, 03:31 PM   #3
Robert0380
LQ Guru
 
Registered: Apr 2002
Location: Atlanta
Distribution: Gentoo
Posts: 1,280

Rep: Reputation: 47
i second that
 
Old 04-21-2002, 04:11 PM   #4
ngomong
Member
 
Registered: Apr 2002
Posts: 54

Rep: Reputation: 15
To answer your question...

The replace portion of sed doesn't handle special characters as you would expect. Instead, create a file, replace.sed, with the following:

s/:/\
/g

Then, at the prompt:
sed -f replace.sed file.txt > newfile.txt

So, instead of \n, you're explicitly inserting the newline.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
sed command Kalyani1 Linux - Software 28 12-07-2005 11:48 AM
sed command rharris72 Programming 6 11-20-2005 08:26 PM
sed command pazvant Linux - Software 2 05-09-2004 12:58 PM
sed command linuxdev Linux - Newbie 9 02-24-2004 04:50 PM
sed Command linuxdev Linux - Newbie 3 02-09-2004 11:27 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 09:17 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration