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
ABRT-ACTION-NOTIFY(1)						    ABRT Manual 					     ABRT-ACTION-NOTIFY(1)

NAME
abrt-action-notify - Announces a new occurrence of problem via all accessible channels SYNOPSIS
abrt-action-notify [-h] -d PROBLEM_DIR [-v] [-a] [-e AUTOREPORTING_EVENT] DESCRIPTION
The current implementation emits a D-Bus signal on System bus in path /org/freedesktop/problems of org.freedesktop.problems interface for Crash member. Integration with ABRT events abrt-action-notify is used to notify new problems and consecutive occurrences of a single problem for all crash types. EVENT=notify package!= abrt-action-notify OPTIONS
-v, --verbose Be verbose -d, --problem-dir PROBLEM_DIR Problem directory [Default: current directory] -h, --help Show help message -a, --autoreporting Force to run autoreporting event -e, --autoreporting-event AUTOREPORTING_EVENT Overwrite autoreporting event name ENVIRONMENT
ABRT_VERBOSE ABRT verbosity level FILES
/etc/abrt/abrt.conf AutoreportingEnabled If enabled, abrt-action-notify runs AutoreportingEvent AutoreportingEvent Name of event to be run if autoreporting is enabled SEE ALSO
abrt.conf(5) AUTHORS
o ABRT team abrt 2.1.11 06/18/2014 ABRT-ACTION-NOTIFY(1)
All times are GMT -4. The time now is 10:54 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy