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



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

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Bash script: issue changing directories in script Breakology Shell Programming and Scripting 5 05-26-2009 08:47 AM
using tar via su in a script issue !!! kpatel786 Shell Programming and Scripting 3 07-07-2008 08:13 PM
Issue in my script chiru_h Shell Programming and Scripting 4 09-27-2006 09:27 AM
please help ftp script issue mgirinath Shell Programming and Scripting 4 04-28-2006 10:33 AM
Issue with sed in script bthomas Shell Programming and Scripting 3 04-14-2005 04:21 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 05-27-2009
shalini_008 shalini_008 is offline
Registered User
  
 

Join Date: May 2009
Posts: 4
Post Issue with awk script

Hi ,

I am using the below awk script

awk '{if($0 ~ /B1/) {set=1; next }; if( $0 ~ /END/) {set = 0}; if (set ) { print }}' CODE | awk '/A \(P1\)/{f=1}f && /}/{print; system("cat $1");f=0;next}1' A.lib > newfile

I need to insert code from CODE file into A.lib file

A.lib file content is

A (P1) {

timing : 10;
cap : 2;
slew : 3;
}
C (P2)

time : 10;
cap : 2;
slew : 3;

}

D (P3)

time : 11;
cap : 4;
slew : 6;
}

A (P1) {

time : 16;
cap : 4;
slew : 7;
}

I could able to enter the code from CODE file while searching the patterns A (P1) but it is not inserting the code for another Block

A (P1) {

time : 16;
cap : 4;
slew : 7;
}

My issue is with Global Replacement with this script whereever it can find A (P1) it should insert the code from CODE file .

I tried to use the g operator but it is not working


Please advice in regards with the same

Thanks
Shalini
  #2 (permalink)  
Old 05-27-2009
Franklin52 Franklin52 is offline Forum Staff  
Moderator
  
 

Join Date: Feb 2007
Posts: 4,212
This is your 3th thread regarding the same question, the 1st thread with the username kshitij.
Please don't double post questions, read the rules.

Continue on one of these threads:

Sed Script Problem

Awk script with a urgent requirement

Thread closed!
Sponsored Links
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -4. The time now is 10:09 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language translation by Google.
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0