saapa
June 3, 2009, 9:29am
1
hi all,
i am facing this problem ,please help.
suppose a file contains conetnts as below:
john itemspurchased/date
john itempurchased/date
james itempurchased/date
john items purchsed/date
so here i want to store john only once in a variable but retreive his 3 corresponding data (items purchesd with date). i. e i want to store each value in the 1st column once only.
need ur help urgently.....
thanks in advance
Are you expecting something like this ??
awk '{a[$1]=a[$1]"\n"$2} END { for (i in a){ print i "-->" a} }' inputfile.txt
saapa
June 3, 2009, 10:44am
3
the above command is showing errors when used in perl script.
is there a way to do this using perl script.
show your Perl script. Or is it you haven't got one?
joeyg
June 3, 2009, 11:22am
5
Whenever someone specifically requests a mode for solution - in this case to provide a perl script - is a big signal that this is likely homework.
Our Rules do not allow assistance with homework.
The UNIX and Linux Forums - Forum Rules
saapa
June 3, 2009, 1:40pm
6
thanks for your solution....it worked and every doubt is a homework:D