Search Results

Search: Posts Made By: jeffreybsu
1,430
Posted By balajesuri
[user@host ~]$ cat file REQ1,Order1,1,1 ...
[user@host ~]$ cat file
REQ1,Order1,1,1
REQ1,Order1,1,3
REQ2,Order2,1,5
REQ2,Order2,1,5
REQ2,Order2,1,5
REQ2,Order2,1,5
[user@host ~]$ awk -F',' '{a[$1","$2","$3]++} END {for(x in a) {for(i=1;...
2,036
Posted By bartus11
Try:awk -F"," 'NR==FNR{a[$1]=$2;next}{$2=a[$1]}1'...
Try:awk -F"," 'NR==FNR{a[$1]=$2;next}{$2=a[$1]}1' OFS="," Bad.csv Breaking.csv > BreakingBad.csv
4,846
Posted By Akshay Hegde
Sorry Jotne you told me before also to replace _...
Sorry Jotne you told me before also to replace _ with some name as its difficult for new users to understand code, I am forgetting every time, I just modified #4 as you said.
4,846
Posted By Jotne
Its not a good habit to use _ as an variable. ...
Its not a good habit to use _ as an variable. New user would have problem understanding what is going on.
Change it to some like
awk -F, '{arr[$3]=arr[$3]?arr[$3] OFS $2:$1 FS $2} END {for(i in...
4,846
Posted By Akshay Hegde
How about this $ awk -F, '{_[$3]=(!(_[$3]))?...
How about this

$ awk -F, '{_[$3]=(!(_[$3]))? $1 FS $2: _[$3] OFS $2}END{for(i in _)print _[i] FS i}' OFS="|" fileEDIT of _ to Arr : Easy to understand as suggested by Jotne in #5
$ awk -F,...
4,846
Posted By Don Cragun
If a given name might have a different email...
If a given name might have a different email address for some groups, you might want to try:
awk '
BEGIN { FS = OFS = "," }
NR == 1 {print
next
}
!(($1,$3) in n) {
...
4,846
Posted By balajesuri
awk -F',' 'NR==1{print;next} {a[$1] = a[$1]"|"$2;...
awk -F',' 'NR==1{print;next} {a[$1] = a[$1]"|"$2; b[$1] = $3} END {for (x in a){print x,substr(a[x],2),b[x]}}' OFS=, FileInput
Showing results 1 to 7 of 7

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