CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Need a Custom or Prewritten Perl Program?: I need a program that...:
I need to edit multiple lines based on pattern


New User

Mar 30, 2016, 11:53 AM

Post #1 of 2 (6386 views)
I need to edit multiple lines based on pattern Can't Post

I have following

someline NNNN something
+ garbage1
+ garbage2
+ garbage3=something
someline PPPP something
+ garbage1
+ garbage2
+ garbage3=something

The "+" means its the continuations line. I want to convert

+ garbage3=something


+ garbage3=0*something

only if NNNN appears in the first line.

Every time line does not start with "+" its a new line.

Thanks for help in advance

Veteran / Moderator

Mar 31, 2016, 9:09 AM

Post #2 of 2 (6380 views)
Re: [ninad007] I need to edit multiple lines based on pattern [In reply to] Can't Post

In your input, are your "logical lines" spread over several "physical lines" the way you have it in your post?

If yes, is it safe to assume that a logical line extents from a
line without a "+" to the line immediately before next line without a "+"?

If yes, is "NNNN" supposed to be a four-digit number? Or how are we supposed to recognize what you named "NNNN"?

It should not be too difficult to do what you want, but we need the extra information requested above to make sure we understand what you need.


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives