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

  Go Back    


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

Add line in exact place

Shell Programming and Scripting


Tags
add line, replace

Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #8  
Old 12-11-2013
Akshay Hegde's Avatar
Akshay Hegde Akshay Hegde is offline Forum Advisor  
Forum Advisor
 
Join Date: Nov 2012
Last Activity: 20 August 2014, 2:16 AM EDT
Location: Goa / Bangalore, India
Posts: 1,439
Thanks: 72
Thanked 446 Times in 407 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

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 02:49 AM.