Hi,
I have this file
----- temp2.txt ------
carlos,2
carlos,3
carlos,4
omar,2
omar,3
omar,4
omar,5
tom,3
tom,4
I want to transform the previous file, temp2.txt in
--- out.txt----
carlos 2 4
omar 2 5
tom 3 4
My program
awk ' BEGIN{FS=","
getline < "temp2.txt"
cent_in = $1
date_in = $2
close(temp2.txt)
}
{
if(cent_in==$1)
{
cent_in=$1
date_l=$2
}
else if(cent_in!=$1)
{
print cent_in,date_in,date_l
cent_in=$1
date_l=$2
date_in=$2
}
} ' temp2.txt > out.txt
my out.txt
carlos 2 4
omar 2 5
??????????? (what´s going on)
Thanks for your timily assistance.
I have this file
----- temp2.txt ------
carlos,2
carlos,3
carlos,4
omar,2
omar,3
omar,4
omar,5
tom,3
tom,4
I want to transform the previous file, temp2.txt in
--- out.txt----
carlos 2 4
omar 2 5
tom 3 4
My program
awk ' BEGIN{FS=","
getline < "temp2.txt"
cent_in = $1
date_in = $2
close(temp2.txt)
}
{
if(cent_in==$1)
{
cent_in=$1
date_l=$2
}
else if(cent_in!=$1)
{
print cent_in,date_in,date_l
cent_in=$1
date_l=$2
date_in=$2
}
} ' temp2.txt > out.txt
my out.txt
carlos 2 4
omar 2 5
??????????? (what´s going on)
Thanks for your timily assistance.