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

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

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

Post #1 of 2 (3749 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

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

Post #2 of 2 (3743 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