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



ninad007
New User

Mar 30, 2016, 11:53 AM


Views: 6366
I need to edit multiple lines based on pattern

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

to

+ 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


Laurent_R
Veteran / Moderator

Mar 31, 2016, 9:09 AM


Views: 6360
Re: [ninad007] I need to edit multiple lines based on pattern

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.