Computing.Net > Forums > Programming > Awk script problem

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Awk script problem

Reply to Message Icon

Name: neha_008
Date: May 30, 2009 at 22:51:08 Pacific
OS: AIX
Subcategory: Opinions
Comment:

hI I am having a big file having content of file like this


pin (PIN1) {
direction : input ;
capacitance : 0.016700 ;
max_transition : 0.4000 ;
}

pin (PIN1) {
direction : input ;
clock : true ;
capacitance : 0.016700 ;
max_transition : 0.4000 ;
timing () {
timing_type : min_pulse_width ;
related_pin : "RXAUPTSTART" ;
fall_constraint (pulse_width_template_2x1) {
index_1 ("0.0010, 0.5000") ;
values ("20, 20") ;
}
rise_constraint (pulse_width_template_2x1) {
index_1 ("0.0010, 0.5000") ;
values ("20, 20") ;
}
}
}

I need to search the pattern P1 and delete the first block , it should not touch the second Block

So the rest of the file content will be :


pin (PIN1) {
direction : input ;
clock : true ;
capacitance : 0.016700 ;
max_transition : 0.4000 ;
timing () {
timing_type : min_pulse_width ;
related_pin : "RXAUPTSTART" ;
fall_constraint (pulse_width_template_2x1) {
index_1 ("0.0010, 0.5000") ;
values ("20, 20") ;
}
rise_constraint (pulse_width_template_2x1) {
index_1 ("0.0010, 0.5000") ;
values ("20, 20") ;
}
}
}

Hi I have written a awk script like this
awk '/PIN1/{c==4};--c<0' file

But it is deleting the content from second Block also

Thanks neha



Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More


control panel Easy Disable/Enable CD RO...



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: Awk script problem

awk script problem www.computing.net/answers/programming/awk-script-problem/18509.html

login script problem www.computing.net/answers/programming/login-script-problem/8742.html

Shell commnd in awk script www.computing.net/answers/programming/shell-commnd-in-awk-script/13781.html