Computing.Net > Forums > Linux > problem with sed

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.

problem with sed

Reply to Message Icon

Name: cseuser
Date: November 20, 2007 at 01:17:05 Pacific
OS: Linux
CPU/Ram: Intel
Product: IBM
Comment:

Hi

I have a problem with sed here.

I used the following to concatenate the next line if I have a semi-colon (;) at the end of a line. This is the command I use

sed '/[^;]$/{N;s/\n//;}'

But now I need to add a condition. I want to check for a word like APPLE in the line and do the concatenation only if I find APPLE in the sentence.

What can I do for this?

Any idea?

Thanks.



Sponsored Link
Ads by Google

Response Number 1
Name: Guy
Date: November 20, 2007 at 18:42:49 Pacific
Reply:

If I use your sed script with this data:

line 1
line 2;
line 3
line 4;
line 5;
line 6

I get this output:

line 1line 2;
line 3line 4;
line 5;
line 6

Is that what you expect?

Please give me sample input data and expected output with APPLE present or not.



0
Reply to Message Icon

Related Posts

See More


Playstation 3 yellow dog ... default nmap-os-fingerpti...



Post Locked

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


Go to Linux Forum Home


Sponsored links

Ads by Google


Results for: problem with sed

problems with ppp www.computing.net/answers/linux/problems-with-ppp/16205.html

problem with videocard in linux redhat www.computing.net/answers/linux/problem-with-videocard-in-linux-redhat/6062.html

NIS problem with non-root user www.computing.net/answers/linux/nis-problem-with-nonroot-user/14927.html