Search Results

Search: Posts Made By: cdubu2
1,207
Posted By RavinderSingh13
Hello cdubu2, On a Solaris/SunOS system,...
Hello cdubu2,

On a Solaris/SunOS system, change awk to /usr/xpg4/bin/awk , /usr/xpg6/bin/awk , or nawk, it should fly then.

Thanks,
R. Singh
1,207
Posted By RavinderSingh13
Hello cdubu2, Could you please try...
Hello cdubu2,

Could you please try following.

awk -F"|" 'FNR==NR{A[$1]=A[$1]?A[$1] "," $3:$3;next} ($1 in A){$3=A[$1];print;delete A[$1]}' OFS="|" Input_file Input_file
Thanks,
R. Singh
1,207
Posted By Scrutinizer
Hi, try: awk '{i=$1 FS $2} !B[$0]++{A[i]=A[i]...
Hi, try:
awk '{i=$1 FS $2} !B[$0]++{A[i]=A[i] (A[i]?",":x) $3; C[i]=$4} END{for(i in A) print i,A[i],C[i]}' FS=\| OFS=\| file


--
awk '
{
i=$1 FS $2 # Set index to...
1,008
Posted By RudiC
Not quite. A[$1]=$2: Create an element for...
Not quite.

A[$1]=$2: Create an element for array A indexed by $1 (the first field in the line) and assign $2 (the second field)'s contents.

next stop processing THIS actual line in file2; read...
1,008
Posted By Scrutinizer
Given the fact that fields in the last column of...
Given the fact that fields in the last column of csv1 occur more than ones, I think it makes more sense that the join should be the other way around (the other way around it takes the last occurrence...
Showing results 1 to 5 of 5

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