Sponsored Content
Top Forums Shell Programming and Scripting awk working inside specific pattern ranges Post 302902679 by MadeInGermany on Wednesday 21st of May 2014 03:38:43 PM
Old 05-21-2014
A range only works outside of all { } so nesting is impossible.
A workaround:
Code:
awk '/BEG/,/EN/ {
 if (/BEG/) {block=1}
 if (block==1) {print $2}
 if (/ID/) {block=0}
}' file

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

looping a array inside inside ssh is not working, pls help

set -A arr a1 a2 a3 a4 # START ssh -xq $Server1 -l $Username /usr/bin/ksh <<-EOS integer j=0 for loop in ${arr} do printf "array - ${arr}\n" (( j = j + 1 )) j=`expr j+1` done EOS # END ========= this is not giving me correct output. I... (5 Replies)
Discussion started by: reldb
5 Replies

2. UNIX for Advanced & Expert Users

formatting textfile inside ksh script using awk not working

I cannot seem to get this text file to format. Its as if the awk statement is being treated as a simple cat command. I manned awk and it was very confusing. I viewed previous posts on this board and I got the same results as with the the awk command statement shown here. Please help. ... (6 Replies)
Discussion started by: tekline
6 Replies

3. Shell Programming and Scripting

[csh] checking for specific character ranges in a variable

I want to check if a zip code is valid, using a variable that stores the zipcode. I am not sure how I would do this in a script. I know that simply checking for the numerical range of the number will not work, because '1' would be '00001' in zip code format. I know when I am in shell, I can use... (5 Replies)
Discussion started by: userix
5 Replies

4. Shell Programming and Scripting

awk to sum specific field when pattern matches

Trying to sum field #6 when field #2 matches string as follows: Input data: 2010-09-18-20.24.44.206117 UOWEXEC db2bp DB2XYZ hostname 1 2010-09-18-20.24.44.206117 UOWWAIT db2bp DB2XYZ hostname ... (3 Replies)
Discussion started by: ux4me
3 Replies

5. Shell Programming and Scripting

getting files between specific date ranges in solaris

hi ! how can i get files in a directory between certain date ranges ? say all files created/modified between Jan24 - Jan31 thanks (10 Replies)
Discussion started by: aliyesami
10 Replies

6. Shell Programming and Scripting

extracting columns falling within specific ranges for multiple files

Hi, I need to create weekly files from daily records stored in individual monthly filenames from 1999-2010. my sample file structure is like the ones below: daily record stored per month: 199901.xyz, 199902.xyz, 199903.xyz, 199904.xyz ...199912.xyz records inside 199901.xyz (original data... (4 Replies)
Discussion started by: ida1215
4 Replies

7. Shell Programming and Scripting

Search IP Address in list of ranges -- not working great

I have been struggling with a script to automate some security related activities. I have it pretty much working, all except the search. I have an input file formatted as such: 216.234.246.158 216.234.246.158 `` 24.249.221.22 24.249.221.200 `` 24.249.226.0 ... (4 Replies)
Discussion started by: tsunami4u
4 Replies

8. Shell Programming and Scripting

Problem passing a search pattern to AWK inside a script loop

Learning, stumbling! My progress in shell scripting is slow. Now I have this doubt: I have the following file (users.txt): AU0909,on AU0309,off AU0209,on AU0109,off And this file (userson.txt) AU0909 AU0209 AU0109 AU0309 I just want to set those users on userson.txt to "off" in... (14 Replies)
Discussion started by: quinestor
14 Replies

9. Shell Programming and Scripting

Problem in Pattern-Specific Actions in awk

Hi i am in learning phase of unix i am able to understand basic of awk but not able to understand Pattern-Specific Actions in awk below is the snippet . awk ' / *\$*\. */ { print $1,$2,$3,"*"; } / *\$0\. */ { print ; } ' fruit_prices.txthere i am not getting the use of wild card. what... (4 Replies)
Discussion started by: scriptor
4 Replies

10. Shell Programming and Scripting

Generate Regex numeric range with specific sub-ranges

hi all, Say i have a range like 0 - 1000 and i need to split into diffrent files the lines which are within a specific fixed sub-range. I can achieve this manually but is not scalable if the range increase. E.g cat file1.txt Response time 2 ms Response time 15 ms Response time 101... (12 Replies)
Discussion started by: varu0612
12 Replies
PG_FILEDUMP(1)							   User Commands						    PG_FILEDUMP(1)

NAME
manual page for pg_filedump SYNOPSIS
pg_filedump [-abcdfhixy] [-R startblock [endblock]] [-S blocksize] file DESCRIPTION
Display formatted contents of a PostgreSQL heap/index/control file. The following options are valid for heap and index files: -a Display absolute addresses when formatting (Block header information is always block relative) -b Display binary block images within a range (Option will turn off all formatting options) -d Display formatted block content dump (Option will turn off all other formatting options) -f Display formatted block content dump along with interpretation -h Display this information -i Display interpreted item details -R Display specific block ranges within the file (Blocks are indexed from 0) [startblock]: block to start at [endblock]: block to end at A startblock without an endblock will format the single block -S Force block size to [blocksize] -x Force interpreted formatting of block items as index items -y Force interpreted formatting of block items as heap items The following options are valid for control files: -c Interpret the file listed as a control file -f Display formatted content dump along with interpretation -S Force block size to [blocksize] OTHERS
This manual page was generated from pg_filedump help output (-h) by help2man(1). REPORTING BUGS
Report bugs to <pgsql-bugs@postgresql.org> pg_filedump 9.2.0 June 2013 PG_FILEDUMP(1)
All times are GMT -4. The time now is 08:03 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy