Unix/Linux Go Back    


Shell Programming and Scripting Unix shell scripting - KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and shell scripts and shell scripting languages here.

Add line in exact place

Shell Programming and Scripting


Tags
add line, replace

Closed Linux or Unix Question    
 
Thread Tools Search this Thread Display Modes
    #8  
Old Unix and Linux 12-11-2013
Akshay Hegde's Unix or Linux Image
Akshay Hegde Akshay Hegde is offline Forum Advisor  
Forum Advisor
 
Join Date: Nov 2012
Last Activity: 22 May 2015, 12:12 AM EDT
Location: Goa / Bangalore, India
Posts: 1,710
Thanks: 84
Thanked 575 Times in 524 Posts
Would this help you ?


Code:
$ awk '/<INCOND NAME=/{print;s=1;next}s{$0=line_to_be;s=""}1' line_to_be='<QUANTITATIVE ="PRICDRL" QUANT="1" ONFAIL="R" ONOK="R" />' file


Code:
<JOB JOBISN="3" APPLICATION="PRICD" SUB_APPLICATION="DALY" PARENT_FOLDER="PDALY">
<INCOND NAME="PL-PICDDMD82-OK" ODATE="PREV" AND_OR="A" />
<QUANTITATIVE ="PRICDRL" QUANT="1" ONFAIL="R" ONOK="R" />
<OUTCOND NAME="PL-PICDDMD01_SOLOMON_HK_DALY-OK" >
<RULE_BASED_CALENDARS NAME="ALL-DAY-TAG" />
</JOB>
 <JOB JOBISN="4" APPLICATION="PRICD" RENT_FOLDER="PRICDG-SOLOMON-DALY">
<INCOND NAME="PL-PICDDMD81_-OK" ODATE="ODAT" AND_OR="A" />
<QUANTITATIVE ="PRICDRL" QUANT="1" ONFAIL="R" ONOK="R" />
<OUTCOND NAME="PL-PICDDMD82_Y-OK" ODATE="ODAT" SIGN="+" />
<RULE_BASED_CALENDARS NAME="ALL-DAY-TAG" />
</JOB>

Sponsored Links
Closed Linux or Unix Question

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Linux More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Copy a field into n line in another place oreka18 Shell Programming and Scripting 17 05-09-2012 09:24 AM
Place variables at the beginning of each line GoldenFire Shell Programming and Scripting 8 11-15-2010 05:18 PM
Formatting a text file to get data in exact line by line rdhanek Shell Programming and Scripting 1 07-02-2009 09:59 AM
Getting the value of a line, that changes place Navigatorchief Shell Programming and Scripting 1 02-19-2008 05:02 PM
How to place the output of two different echo statements on one line JoBa Shell Programming and Scripting 5 11-20-2002 09:54 AM



All times are GMT -4. The time now is 12:05 PM.