|
|||||||
| Forums | Search Forums | Register | Forum Rules | Man Pages | Albums | FAQ | Members | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
|
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Need Help in arranging the output
Hello All,
Please find attached input and output files. I want to write a shell script to achieve this. I tried using awk but not getting how to do this as I am new to shell programming. Thanks |
| Sponsored Links | ||
|
|
#2
|
||||
|
||||
|
Try: Code:
awk -vRS= '{a[$1]=a[$1](a[$1]?",":"")$2}END{for (i in a) print i","a[i]}' file |
| The Following User Says Thank You to bartus11 For This Useful Post: | ||
Sudeep Bhattad (10-25-2012) | ||
| Sponsored Links | ||
|
|
#3
|
|||
|
|||
|
when I am running the command that you have given me, it is throwing some errors :-
awk: syntax error near line 1 awk: illegal statement near line 1 |
|
#4
|
||||
|
||||
|
Use
/usr/xpg4/bin/awk or
nawk on Solaris.
|
| Sponsored Links | |
|
|
#5
|
|||
|
|||
|
As I specified in the output file attached, I need an output like this -
sudeep,kapil,ritesh ... and I am getting the output like this - , kapil, ritesh, sudeep, Please tell me how should I modify the command....and if you don't mind, please explain the command once as I am new to scripting. |
| Sponsored Links | ||
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Arranging data | bobo | UNIX for Dummies Questions & Answers | 3 | 01-20-2012 02:15 PM |
| arranging columns with AWK | sramirez | Shell Programming and Scripting | 2 | 12-12-2010 02:06 PM |
| need help in arranging the alias | upengan78 | Shell Programming and Scripting | 4 | 07-09-2010 04:29 PM |
| Re-arranging lines of text... help? | shorte85 | UNIX for Dummies Questions & Answers | 2 | 02-26-2009 12:54 PM |
| Arranging files | Vivek788 | Shell Programming and Scripting | 2 | 06-07-2008 10:18 PM |
|
|