Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


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

Rep: Reputation: 0
Sed Command : Line Start with

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 !
Old 05-30-2005, 10:12 AM   #2
Registered: Dec 2002
Location: In front of a computer
Distribution: UPS, DHL, FedEx
Posts: 466

Rep: Reputation: 38

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

where xxx is the file with the text.
Old 05-31-2005, 02:28 AM   #3
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


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 / openSUSE 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 04:34 PM.

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