Hello once again Monks,
I hope this will be my last question for some time. My file looks something like this:
Class control
priority 5
Class voip
priority 30
Class video
priority 40
Class control
priority 10
Class voip
priority 25
Class video
priority 45
What I need to do is keep the first occurrance of the word 'priority', but substitute duplicate occurrences before the blank lines. Basically, it should look something like this:
Class control
priority 5
Class voip
bandwidth 30
Class video
bandwidth 40
Class control
priority 10
Class voip
bandwidth 25
Class video
bandwidth 45
While I know I can use 'sed' to replace it, I need to keep the first occurrance of it in every paragraph, for lack of a better term. I'm not even sure if this is possible, since it will have to keep every first occurance per paragraph. Also, this will be part of a 600+ line script, so I didn't add the code that got me to this point either. Any ideas will be greatly appreciated, I don't even know where to start on this.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.