![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Rules & FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| how to sort, and count unique data all at once? | amatuer_lee_3 | Shell Programming and Scripting | 13 | 05-15-2008 07:48 AM |
| Separate string | arghya_owen | Shell Programming and Scripting | 3 | 05-14-2008 12:35 AM |
| How to count the record count in an EBCDIC file. | oracle8 | UNIX for Dummies Questions & Answers | 1 | 07-26-2006 04:22 PM |
| separate out the column | ust | Shell Programming and Scripting | 6 | 12-29-2005 03:11 AM |
| How to separate a variable | whatisthis | Shell Programming and Scripting | 4 | 11-02-2004 09:49 AM |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
hi experts,
i have some problem with count data which separate by comma, below sample data : 01,011222823b6d,011222823f29,0028a5,002993,6212345678, 659111111111,6598204507,6281105008,6596197849,_,525016160836958,_, ffffffff,000000000000000000000000,_,_,_,fd,fd,ff,00,1,0028a5-002993,_, ff,8,3b7,_,_,80005ea,_,_,_,_ one day file have about 12000 files at log files i want to count how much having "01" and "_" and "000000000000000000000000" and "659111111111" line by line in a files. the log file have two format in the directory, example : /200704/20070401/ABC_2007040100-2007040101 /200704/20070401/ABC_2007040100-2007040101.out i want only count without .out files. nb:one directory have about 12000 files please help Thank you so much Best Regards, bucci Last edited by reborg; 04-24-2007 at 09:32 AM. Reason: disable smiley |
| Forum Sponsor | ||
|
|
|
|||
|
Code:
awk -F"," ' {
for( i = 1 ; i <= NF ; ++i )
{
if( $i == "01" || $i == "659111111111" || $i == "000000000000000000000000" || $i == "_" )
{
arr[FILENAME]++;
break;
}
}
}
END { for( file in arr ) { print file ":" arr[file] } }
' *.out
|
|
|||
|
Hi Anbu,
thank you for you quick response very appreciate, but when i run the syntax i got an error like this : "Arguments too long". fyi, one day have about 12000 files. actually, i want to count only line which have "01" and "000000000000000000000000" in column 15 and "_" in column 16 line by line please advice Thank you Best Regards, bucci Quote:
|
|
|||
|
hi Anbu,
sorry have a little mistake info, i means is want to count file by file and in file line by line which in the files data only have "01" in column 1 and "000000000000000000000000" in column 15 and "_" in column 16, the data in each files created can have different like in other file can have "000AB04" in column 16 or "00000000000000000000A74B" in column 15 but all count is reference to "01" in column 1. lets say filename is ABC_2007040100-2007040105, ABC_2007040105-2007040110,etc note : the file is created each 15 minutes please help with simple script thanks please advice Thank you so much Best Regards, bucci Quote:
|
|
|||
|
Hi anbu,
Thanks for you response the sample output is like : found "01" at column 1 and without "_" at column 16 count = 1000 found "01" at column 1 and with "00000000000000000000000" at column 15 count = 2000 please advice Thank you Best Regards, pm.wu Quote:
|
|||
| Google UNIX.COM |