Sponsored Content
Full Discussion: range patterns in awk
Top Forums Shell Programming and Scripting range patterns in awk Post 302481977 by Franklin52 on Monday 20th of December 2010 10:18:02 AM
Old 12-20-2010
Quote:
Originally Posted by ghoda2_10
Below are two functions in the file
Code:
function $reset_report(), invisible
{
 a = set_value;
 return @true;
}

function $reset_palette_menu(),INDIRECT
{
  if ( v == "")
    $notify(message1, @warning);
  else {
    $replace_palette();
   }
 b = value; 
}

and I need the output to be:
Code:
function $reset_palette_menu(),INDIRECT
{
  if ( v == "")
    $notify(message1, @warning);
  else {
    $replace_palette();
   }
 b = value; 
}

but the command I wrote above only prints the function until the first "}":
Code:
function $reset_palette_menu(),INDIRECT
{
  if ( v == "")
    $notify(message1, @warning);
  else {
    $replace_palette();
   }

This also works with more curly brackets {} in your function:
Code:
awk '/reset_report/{f=1;getline} f{c+=/}/?1:/{/?-1:0}; !f; f && !c{f=0}' file

 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

AWK: Multiple patterns per line

Hi there, We have been given a bit of coursework using awk on html pages. Without giving too much away and risking the wrath of the plagerism checks, I can say we need to deal with certain html elements. There may be several of these elements on one line. My question is, if there are more... (1 Reply)
Discussion started by: Plavixo
1 Replies

2. Shell Programming and Scripting

print range between two patterns if it contains a pattern within the range

I want to print between the range two patterns if a particular pattern is present in between the two patterns. I am new to Unix. Any help would be greatly appreciated. e.g. Pattern1 Bombay Calcutta Delhi Pattern2 Pattern1 Patna Madras Gwalior Delhi Pattern2 Pattern1... (2 Replies)
Discussion started by: joyan321
2 Replies

3. Shell Programming and Scripting

range in if using awk

Hi All, I would like to assign the following values to each column in my file. if $i is between 1 and -1 (ie -1 < $i < 1) then print A; if $i is between -2 and -1 && 1 and 2 (ie. -2 < $i < -1 && 1 < $i < 2) then print B; if $i is between -3 and -2 && 2 and 3 (ie. -3 < $i < -2 && 2 < $i < 3)... (1 Reply)
Discussion started by: Fredrick
1 Replies

4. Shell Programming and Scripting

[Solved] HP-UX awk sub multiple patterns

Hi, I am using sub to remove blank spaces and one pattern(=>) from the input string. It works fine when I am using two sub functions for the same. However it is giving error while I am trying to remove both spaces and pattern using one single sub function. Working: $ echo " OK => " |awk... (2 Replies)
Discussion started by: sai_2507
2 Replies

5. Shell Programming and Scripting

awk comparison with two patterns

Here is my list, which contains URLs for file downloads: //servername.com/version/panasonic1,1_1.1.1 //servername.com/version/panasonic3,1_6.7.1 //servername.com/version/panasonic3,2_6.8 //servername.com/version/panasonic2,6_3.0.2 //servername.com/version/panasonic3,1_7.1.3... (5 Replies)
Discussion started by: ibanezpete
5 Replies

6. Shell Programming and Scripting

Searching multiple patterns using awk

Hello, I have the following input file: qh1adm 20130710111201 : tp import all QH1 u6 -Dsourcesystems=BFI,EBJ qh1adm 20130711151154 : tp import all QH1 u6 -Dsourcesystems=BFI,EBJ qx1adm 20130711151154 : tp count QX1 u6 -Dsourcesystems=B17,E17,EE7 qh1adm 20130711151155 : tp import all... (7 Replies)
Discussion started by: kcboy
7 Replies

7. Shell Programming and Scripting

Specifying patterns to egrep or awk

given this information: ^\w{3} {11} -]+ kernel:( \]+\.]+\])? ]+: media error \(bad sector\): status=0x]+ { DriveReady SeekComplete Error }$ ^\w{3} {11} -]+ kernel:( \]+\.]+\])? end_request: I/O error, dev ]+, sector ]+ i need to set up monitoring for these strings. but as you can see, they... (2 Replies)
Discussion started by: SkySmart
2 Replies

8. Shell Programming and Scripting

awk search patterns from file in another

I would like to grep for aaa and bbb and ccc from one line in file1.txt in any order on a line on file2.txt file1.txt aaa bbb ccc ddd fff ggg hhh ddd jjj jjj cccfile2.txt aaa bbb ccc ddd fff ggg --> output whole line since it matches with aaa bbb ccc of file1.txt aaa ddd jjj hhh --> no... (1 Reply)
Discussion started by: sdf
1 Replies

9. UNIX for Beginners Questions & Answers

TCL script to print range of lines between patterns

Hi I am having a code as stated below module abcd( a , b , c ,da , fa, na , ta , ma , ra , ta, la , pa ); input a , b, da ,fa , na , ta , ma; output c , ra ,ta , la ,pa ; wire a , b , da , fa ,na , ta , ma; endmodule I need to match the string... (1 Reply)
Discussion started by: kshitij
1 Replies

10. UNIX for Beginners Questions & Answers

Match patterns between two files and extract certain range of strings

Hi, I need help to match patterns from between two different files and extract region of strings. inputfile1.fa >l-WR24-1:1 GCCGGCGTCGCGGTTGCTCGCGCTCTGGGCGCTGGCGGCTGTGGCTCTACCCGGCTCCGG GGCGGAGGGCGACGGCGGGTGGTGAGCGGCCCGGGAGGGGCCGGGCGGTGGGGTCACGTG... (4 Replies)
Discussion started by: bunny_merah19
4 Replies
Net::Akamai::ResponseData(3pm)				User Contributed Perl Documentation			    Net::Akamai::ResponseData(3pm)

NAME
Net::Akamai::ResponseData - Object to hold response data DESCRIPTION
Data container for an akamai purge response Attributes uri_index Identifies the index of the first failed URL in the array. A value of -1 indicates no bad URLs, or error before parsing them. result_code Indicates sucess or failure of request est_time Estimated time for request to be processed in seconds session_id Unique id for request result_msg Explains result code Methods successful Returns true if the result code is of the 1xx (successful) variety. warning Returns true if the result code is of the 2xx (warning) variety. The Akamai documentation states that "The remove request has been accepted" even when a warning response is sent. accepted Returns true if the result code is of the 1xx (successful) or 2xx (warning) varieties. This indicates that the remove request was accepted by Akamai. You should still check to see if there was a warning, and if their was report it. message if (!$res_data->accepted()) { # These do the same thing: die "$res_data"; die $res_data->message(); } Returns a nicely formatted string containing the result_code and result_msg. AUTHOR
John Goulah <jgoulah@cpan.org> LICENSE
This library is free software, you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.10.1 2010-12-22 Net::Akamai::ResponseData(3pm)
All times are GMT -4. The time now is 10:27 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy