The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #4 (permalink)  
Old 07-17-2008
Annihilannic Annihilannic is offline Forum Advisor  
  
 

Join Date: May 2008
Location: Sydney, Australia
Posts: 1,009
Here, I've done most of the work for you, you should be able to finish it easily:

Code:
awk '
        /n="rights"/ {
                print
                getline ; print
                getline ; print
                getline
                if (match($0,"debugLevel")) {
                        print "<a n=\"debugLevel\">\n<v s=\"4\"/>\n</a>"
                        # consume and discard next two lines
                        getline
                        getline
                } else {
                        # do some stuff here
                        print
                }
                next
        }
        1 # print other lines
' inputfile > outputfile
You just need to fill in the "do some stuff here" part.