Awk script with a urgent requirement


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Awk script with a urgent requirement
# 1  
Old 05-25-2009
Java Awk script with a urgent requirement

The Problem content is
pin (AND1) {
dir : output;
cap : hot;
tran: slew;
}
need to write a awk script which can search the Pin AND1 and then tran of the Group pin(AND1)
and then insert the code from the file "insert_code" .
insert_code file contents . It is a Big file the script should match the keywords #PIN (AND1) and #END
in the insert_code section and then insert the content in the file file1

#PIN (AND1)
timing () {
related_pin : GOOD ;
timing_type : setup_rising ;
rise_constraint (scalar) {
values ("TRIN") ;
}
fall_constraint (scalar) {
values ("BAD") ;
}
}
timing () {
related_pin : HSSRESYNCCLKOUT_int ;
timing_type : hold_rising ;
rise_constraint (scalar) {
values ("GOOD") ;
}
fall_constraint (scalar) {
values ("BAD") ;
}
}
}

#END

the new file file2 content after inserting the code should be :

pin (AND1) {
dir : output;
cap : hot;
tran: slew;
timing () {
related_pin : GOOD ;
timing_type : setup_rising ;
rise_constraint (scalar) {
values ("TRIN") ;
}
fall_constraint (scalar) {
values ("BAD") ;
}
}
timing () {
related_pin : HSSRESYNCCLKOUT_int ;
timing_type : hold_rising ;
rise_constraint (scalar) {
values ("GOOD") ;
}
fall_constraint (scalar) {
values ("BAD") ;
}
}
}
}


CAN ANYONE HELP ME OUT IN THIS URGENTLY

Thanks and Regards
Kshitij
# 2  
Old 05-25-2009
Can you show us what have you tried so far and where you are stuck? With the examples given in this thread:

https://www.unix.com/shell-programmin...wk-script.html

you should be able to find out how to insert the insert file at the desired position in your file.
# 3  
Old 05-25-2009
awk '/PIN1/{f=1}f && /}/{print;system("cat insert_code");f=0;next}1' FILE > newfile

I tried with this but the Problem is the code is getting inserted like this

pin (PIN1 )
...
...
max_tran ...
}

insert_code file contents

actually it should be like this

pin (PIN1)

..

..

max_tran

insert_code file content

}

the insert_code file content has been modified and flags have been added with # so that we can match the pattersn which are with # and rest of the code will be inserted in the file 1 contents

Right now insert_code is getting inserted in the file 1 along with the keywords # which I need to avoid

Thanks and Regards
Kshitij Kulshreshtha
# 4  
Old 05-25-2009
You are using the same code given for another situation. Devtakh has given you a explanation how the code works.

If it's so urgent for you, why don't you try to understand how it works and try to adjust the code?

You are expecting us to do the work for you, but that's not the way it works. We are all volunteering our time and expertise, we can give you the direction you need, but you have to put some effort into solving your own problem.

Regards
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

URGENT Reading a file and assessing the syntax shell script URGENT

I am trying to write a shell script which takes an input file as an arguement in the terminal e.g. bash shellscriptname.sh input.txt. I would like for the file to be read line by line each time checking if the .txt file contains certain words or letters(validating the syntax). If the line being... (1 Reply)
Discussion started by: Gurdza32
1 Replies

2. UNIX for Dummies Questions & Answers

Script requirement

Please help in creating script for below requirement. I will be running 1 command and will get below entries in a text file say file44.txt ******************************* DFDL1005 06:30 00:05 ABFL2003 10/22 01:10 CFTL1256 10/24 00:10 10/25 09:20 PM ******************************** .... (3 Replies)
Discussion started by: Vinay_3308
3 Replies

3. Shell Programming and Scripting

Help to write a script for the below requirement

Hi, I am not so familiar with shell Script but I have a task in hand. So, here it goes: There is a file details.txt in the server where the below details are stored: Name Country D M Acc.No. sameer India 30 july sscc-errttt-q random US 20 july pecc-ttt4-s Deb India 31... (3 Replies)
Discussion started by: neel87
3 Replies

4. Shell Programming and Scripting

How to write bash shell script for mentioned requirement?

Hi All, I am unable to write the script for the below requirement. Requirement: Main table dir_ancillary table contain three column "dir_ancillary.table_name"," dir_ancillary.text_file_name ", "dir_ancillary.Include" . This dir_ancillary contain undefined tables in the column... (2 Replies)
Discussion started by: Vineeta Nigam
2 Replies

5. Shell Programming and Scripting

URGENT REQUIREMENT

1.Write an automated shell program(s) that can create, monitor the log files and report the issues for matching pattern. (i) Conditions for creating log files. Log file is created with date (example 2010_03_27.log). If the log file size is 10 Mb for a particular day then automatically the log... (3 Replies)
Discussion started by: praveen12
3 Replies

6. Shell Programming and Scripting

urgent help awk script

Hi I have a scenario where i have a file name as abcd_To_hfgh.20090456778_1.dat I will get the filename as parameter and i need a string in between second _ and first . i.e i need hfgh in this case. Please help me with the script. This may not be awk script even if it can be... (2 Replies)
Discussion started by: dsdev_123
2 Replies

7. Shell Programming and Scripting

Required Shell script for My requirement

Hi All, I joined today in this forum to have all of your help. I have a Big requirement, pls. help me to resolve. I'm using HP-UX 11.23. I need a shell script for the following requirement. I have a file (nodes.txt) that contains 1000 nodes. I'm running the following command:... (3 Replies)
Discussion started by: ntgobinath
3 Replies

8. Shell Programming and Scripting

help in writing awk script, plz urgent

I have a file like this I have to I have input file this , I want to give the out put in the below input file (NARAYANA 1 ENDING AT (100, 16383) ,NARAYANA 2 ENDING AT (100, 32766) ,NARAYANA 3 ENDING AT (100, 49149) ,NARAYANA 4 ENDING AT (100, 65535) ,NARAYANA 5... (8 Replies)
Discussion started by: LAKSHMI NARAYAN
8 Replies
Login or Register to Ask a Question