Search Results

Search: Posts Made By: Franklin52
2,354
Posted By Franklin52
To maintain the order of the records: awk '{ ...
To maintain the order of the records:
awk '{
if(!a[$1]){
b[c++]=$1
}
a[$1]+=$2
}
END{
for(i=0;i<c;i++)
print b[i] FS a[b[i]]
}' file

Use nawk or /usr/xpg4/bin/awk on...
2,354
Posted By Franklin52
awk '{a[$1]+=$2}END{for(i in a){print i, a[i]}}'...
awk '{a[$1]+=$2}END{for(i in a){print i, a[i]}}' file
Showing results 1 to 2 of 2

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