LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (http://www.linuxquestions.org/questions/programming-9/)
-   -   Insert a new value (http://www.linuxquestions.org/questions/programming-9/insert-a-new-value-931036/)

bnbhp0 02-24-2012 07:22 AM

Insert a new value
 
Hi All,

MY requirement is, whenever i find key word as "SEVERITY" it has to check the next line and if next line is not "APPLICATION" then it has to insert the value as "APPLICATION".

can someone help me how we can do this using sed/awk/perl.

My text file looks like this:

SEVERITY
APPLICATION
MESSAGE
OBJECT
....
....
SEVERITY
NODENAME
TEXT
MESSAGE
.....
.....
SEVERITY
NODENAME
TEXT
MESSAGE
........
.......
SEVERITY
TEXT
MESSAGE

......
SEVERITY
NAME
TEXT
MESSAGE

acid_kewpie 02-24-2012 07:25 AM

Please post your thread in only one forum. Posting a single thread in the most relevant forum will make it easier for members to help you and will keep the discussion in one place. This thread is being closed because it is a duplicate.


All times are GMT -5. The time now is 07:05 PM.