Sponsored Content
Top Forums Shell Programming and Scripting Why sum of recs in awk don't match total rec count? Post 302772775 by mjf on Tuesday 26th of February 2013 07:46:21 PM
Old 02-26-2013
Thanks for the explanation alister! I was able to find the offending line missing the newline char.

Last edited by mjf; 02-26-2013 at 09:45 PM..
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

how to count number of rows and sum of column using awk

Hi All, I have the following input which i want to process using AWK. Rows,NC,amount 1,1202,0.192387 2,1201,0.111111 3,1201,0.123456 i want the following output count of rows = 3 ,sum of amount = 0.426954 Many thanks (2 Replies)
Discussion started by: pistachio
2 Replies

2. Shell Programming and Scripting

awk count characters, sum, and divide by another column

Hi All, I am another biologist attempting to parse a large txt file containing several million lines like: tucosnp 56762 T Y 228 228 60 23 .CcCcc,,..c.c,cc,,.C... What I need to do is get the frequency of periods (.) plus commas (,) in column 9, and populate this number into another... (1 Reply)
Discussion started by: peromhc
1 Replies

3. Shell Programming and Scripting

Total Count using AWK

Hi Everybody, I have the following example file... 199|TST-GURGAON|GURGAON|1 199|TST-GURGAON|GURGAON|1 199|TST-GURGAON|GURGAON|1 199|TST-GURGAON|GURGAON|1 199|TST-GURGAON|GURGAON|1 199|TST-GURGAON|GURGAON|1 199|TST-GURGAON|GURGAON|1 199|TST-GURGAON|GURGAON|1 199|TST-GURGAON|GURGAON|1... (8 Replies)
Discussion started by: sraj142
8 Replies

4. Shell Programming and Scripting

awk and count sum ?

I have a input.txt file which have 3 fields separate by a comma place, os and timediff in seconds tampa,win7, 2575 tampa,win7, 157619 tampa,win7, 3352 dallas,vista,604799 greenbay,winxp, 14400 greenbay,win7 , 518400 san jose,winxp, 228121 san jose,winxp, 70853 san jose,winxp, 193514... (5 Replies)
Discussion started by: sabercats
5 Replies

5. Shell Programming and Scripting

sum using awk with pattern match

I have a file which has data like this *** Query completed. One row found. *** Query completed. One row found. *** Query completed. One row found. *** Insert completed. 5 rows added. *** Query completed. No rows found. *** Query completed. One row found. *** Query completed. One... (2 Replies)
Discussion started by: sol_nov
2 Replies

6. Shell Programming and Scripting

awk Help -- If match found return the count

Hi All, I need to get the count of records in the file, if the passing parameter matches with the list of records in the file. Below is my example source file: Test1.dat 20120913 20120913 20120912 20120912 20120912 20120912 20120912 20120913 20120913 20120912 In my script I am... (5 Replies)
Discussion started by: bbc17484
5 Replies

7. Shell Programming and Scripting

awk pattern match and count unique in column

Hi all I have a need of searching some pattern in file by month and then count unique records D11 G11 R11 -------> Pattern available in file S11 Jan$1 to $5 column contains some records in which I want to find unique for this purpose I have written script like below awk '/Jan/ ||... (4 Replies)
Discussion started by: nex_asp
4 Replies

8. Shell Programming and Scripting

awk to output match and mismatch with count using specific fields

In the below awk I am trying output to one file those lines that match between $2,$3,$4 of file1 and file2 with the count in (). I am also trying to output those lines that are missing between $2,$3,$4 of file1 and file2 with the count of in () each. Both input files are tab-delimited, but the... (7 Replies)
Discussion started by: cmccabe
7 Replies

9. UNIX for Beginners Questions & Answers

Awk: count unique elements in a field and sum their occurence across the entire file

Hi, Sure it's an easy one, but it drives me insane. input ("|" separated): 1|A,B,C,A 2|A,D,D 3|A,B,B I would like to count the occurence of each capital letters in $2 across the entire file, knowing that duplicates in each record count as 1. I am trying to get this output... (5 Replies)
Discussion started by: beca123456
5 Replies
cr(1)							      General Commands Manual							     cr(1)

NAME
cr - converts text files between nix EOL and dos EOL SYNOPSIS
cr - | + <input file> <output file> DESCRIPTION
Text files, such as tle files, that come from a dos source usualy have the ^M symbol at the end of every line. Cr converts files between the dos newline format and the normal *nix newline format by stripping the ^M to convert dos to *nix, using the '-' option, or adding ^M to a *nix file to create the proper dos file when the '+' option is used. Although this extra character is not often a problem, programs like seesat5, which are data driven will encounter parsing problems when the extra character is present. It is these problems that cr is intended to repair. Options - | + One or the other of these options is required. The '-' option is used to remove ^M from all newlines found in the dos file. The '+' option is used to add ^M to every newline found in a *nix file. input file Fully delineated path to the input file. As this program is used in the dos environment as well, standard input is not used. output file Fully delineated path to the output file. As this program is used in the dos environment as well, standart output is not used. SEE ALSO
seesat5(1), seesat5(7), SEESAT5.INI(5), tle(5) BUGS
Cr is not an inteligent program. It methodicaly replaces/removes the offending character when it finds it in the correct context. Newline sequences found in contexts other than 'newline' will be replaced/removed just like those found in the proper context. Passing a binary file through cr is not advised, for this reason. Send all inqueries to Dale Scheetz <dwarf@polaris.net>. Debian Linux 2 April 96 cr(1)
All times are GMT -4. The time now is 05:26 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy