another vexing awk problem


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting another vexing awk problem
# 8  
Old 12-19-2011
Code:
awk 'FNR==1 {print FILENAME; fcount=0} /Total/ {if (fcount++<20) print}' /ulogs/dblocks_logs/*log

# 9  
Old 12-19-2011
Quote:
Originally Posted by CarloM
Code:
awk 'FNR==1 {print FILENAME; fcount=0} /Total/ {if (fcount++<20) print}' /ulogs/dblocks_logs/*log

Thnx !! That worked perfectly
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Awk-if problem

Hi This's my problem ( AIX ) switchshow | awk ' { if ( $1==0 ) print $0; }'It works But these below doesn't switchshow | awk ' { if ( $1==0 1 2 3 4 7 9 12 15 ) print $0; }'switchshow | awk ' { if ( $1== 7 9 12 15 ) print $0; }'Somebody help, please :(:(:( (3 Replies)
Discussion started by: bobochacha29
3 Replies

2. Shell Programming and Scripting

awk problem

i have an email list in file.txt with comma separated line1 - FIELD1,pippo@gmail.com,darth@gmail.com line2 - FIELD2,pippo@gmail.com,darth@gmail.com,sampei@gmail.com output=(awk -F ',' -v var="$awkvar" '$1==var {print $2,$3,$4}' spreadsheet.txt)but awk delete some letters at the... (8 Replies)
Discussion started by: pasaico
8 Replies

3. Shell Programming and Scripting

awk if else problem

Hi, I am trying to put if else on some field of a file but not getting it where to put it. find . -name "*" -ctime -6 | xargs cat | grep -E -v ^fileName\|^\(\) | awk -v DATE="${CURR_DATE}" -v DATE_LOG="$DATE_SYS" -v IN="" ' BEGIN { FS = ";" OFS = ";"... (9 Replies)
Discussion started by: abhi1988sri
9 Replies

4. Shell Programming and Scripting

awk problem - combining awk statements

i have a datafile that has several lines that look like this: 2,dataflow,Sun Mar 17 16:50:01 2013,1363539001,2990,excelsheet,660,mortar,660,4 using the following command: awk -F, '{$3=strftime("%a %b %d %T %Y,%s",$3)}1' OFS=, $DATAFILE | egrep -v "\-OLDISSUES," | ${AWK} "/${MONTH} ${DAY}... (7 Replies)
Discussion started by: SkySmart
7 Replies

5. Shell Programming and Scripting

Problem with AWK

when i used to run this command A2=`cat temp |awk -F "," '{print $7}' | awk -F ";" '{print $1}'` give the requited O/P but when i use this command in script its taking only is there any problem in using this command in script or spaces are not readable in script (2 Replies)
Discussion started by: sagar_1986
2 Replies

6. Shell Programming and Scripting

Most vexing: Sed or Awk scripting for date conversion needed

Hi, I have some files being sent to me that have dates in them in this format: from 1/8/2011 15:14:20 and I need the dates in this format (mysql date format) To 2011-01-08 15:14:20 all I have so far is the regexp that detects the format: sed -r -e 's@\1/\2/\3\4\5\6]::$@do... (7 Replies)
Discussion started by: Astrocloud
7 Replies

7. Shell Programming and Scripting

awk problem

Find the number of files with sizes > 100KB in /, /bin, /usr, /usr/bin and /usr/sbin directories and output them in a two column format with the name of the directory and the number of files. i tried with awk $>ls -lh | awk '/^-/ && $5 >= 100k {print $8 $5}' but it is not working pls tell... (3 Replies)
Discussion started by: abhikamune
3 Replies

8. Shell Programming and Scripting

Problem with awk awk: program limit exceeded: sprintf buffer size=1020

Hi I have many problems with a script. I have a script that formats a text file but always prints the same error when i try to execute it The code is that: { if (NF==17){ print $0 }else{ fields=NF; all=$0; while... (2 Replies)
Discussion started by: fate
2 Replies

9. Shell Programming and Scripting

Awk problem: How to express the single quote(') by using awk print function

Actually I got a list of file end with *.txt I want to use the same command apply to all the *.txt Thus I try to find out the fastest way to write those same command in a script and then want to let them run automatics. For example: I got the file below: file1.txt file2.txt file3.txt... (4 Replies)
Discussion started by: patrick87
4 Replies

10. Shell Programming and Scripting

awk problem.

Hi, I have a file containing this data. *** *** *** 123 34 345 456 12 478 *** *** *** now i want to create a new file where third coloum is not null. i tried awk but it is not working. my command like this awk $3 != '/***/' | "{print $1 $2 $3... (1 Reply)
Discussion started by: rajan_ka1
1 Replies
Login or Register to Ask a Question