> Add line in exact place - Page 2 | Unix Linux Forums | Shell Programming and Scripting

  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    
 
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: 25 July 2016, 7:47 AM EDT
Location: Dona Paula, Panjim, Goa - 403004
Posts: 1,758
Thanks: 97
Thanked 607 Times in 542 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

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 05:59 PM.