LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 05-30-2005, 06:12 AM   #1
benjagol
LQ Newbie
 
Registered: May 2005
Posts: 2

Rep: Reputation: 0
Sed Command : Line Start with


Hi,
I need to append to previous line all the line not starting by 2005, here is a example :

2005abcdefghij .....
1234567 ....
2005abcdefghij .....

The result should be
2005abcdefghij ..... 1234567
2005abcdefghij .....

Apparently, sed command could help for that :
sed -e :a -e '/$!N;s/\N2005/ /;ta' -e ...

But I don't know exactly how to do that ...
Please help !
Tks
 
Old 05-30-2005, 10:12 AM   #2
niknah
Member
 
Registered: Dec 2002
Location: In front of a computer
Distribution: UPS, DHL, FedEx
Posts: 466

Rep: Reputation: 38
try...

sed -ne '/^2005/{N; s/\n//; p;}' <xxx

where xxx is the file with the text.
 
Old 05-31-2005, 02:28 AM   #3
benjagol
LQ Newbie
 
Registered: May 2005
Posts: 2

Original Poster
Rep: Reputation: 0
Tks Man, It's working !!!

I really appreciate your help.

Hope I can help you next time !

Best Regards
Benjamin
 
  


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 Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do you start X-window from command line? yekrahs Suse/Novell 2 11-18-2005 09:12 AM
How to start up in to command line? prettyhatem Linux - Newbie 5 09-07-2004 02:01 PM
Insert character into a line with sed? & variables in sed? jago25_98 Programming 5 03-11-2004 06:12 AM
How can I start X from the command line JTWebster Linux - Newbie 3 08-24-2002 10:38 PM
want to start command line from telnet tarak4u Linux - Networking 5 05-16-2002 11:19 AM


All times are GMT -5. The time now is 05:12 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration