Search Results

Search: Posts Made By: Jram
3,150
Posted By Jram
Sum of 286th column using awk in a file
Hi,

I am using the following code to find the sum of the values of column 286 in a file. It will have the Decimal values with the scale of 2. Delimiter is '|^'


cut -d'|^' -f286 filename|cut...
24,031
Posted By Jram
Hi, Thanks for your response.. Now my...
Hi,

Thanks for your response..

Now my file is having around 300 columns and awk is giving an error message "awk cannot have more than 199 fields" while summing up the columns 80 and 138.
...
24,031
Posted By Jram
Hi RudiC, Tried as suggested.. ...
Hi RudiC,

Tried as suggested..

following is the issue

[root@host-6-113 ~]# awk 'BEGIN {FS="\|\^"} {sum+=$5+$8} END {print sum}' infile
awk: warning: escape sequence `\|' treated as plain...
24,031
Posted By Jram
Sum of two columns in a file
Hi,

I need to do a sum of two columns in a file where delimiter is |^

input

1|^2|^3|^4|^50|^2|^3|^100
2|^3|^4|^6|^100|^7|^2|^50
3|^4|^2|^3|^50|^6|^3|^50
4|^2|^5|^7|^25|^2|^8|^25
...
Showing results 1 to 4 of 4

 
All times are GMT -4. The time now is 09:08 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy