LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Sed Command : Line Start with (https://www.linuxquestions.org/questions/linux-newbie-8/sed-command-line-start-with-328488/)

benjagol 05-30-2005 06:12 AM

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

niknah 05-30-2005 10:12 AM

try...

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

where xxx is the file with the text.

benjagol 05-31-2005 02:28 AM

Tks Man, It's working !!!

I really appreciate your help.

Hope I can help you next time !

Best Regards
Benjamin


All times are GMT -5. The time now is 05:40 AM.