LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-16-2014, 02:59 AM   #1
firozindia
LQ Newbie
 
Registered: Mar 2014
Posts: 1

Rep: Reputation: Disabled
concatenate the rows using awk


Consider the following example of Table1

usrID orderID deliverID
1 303 102
1 304 103
2 305 NULL
2 306 105
3 307 NULL
3 308 NULL

I want to concat the orderID, deliverID and if userID same, as following

usrID orderID_group deliverID_group
1 303,304 102,103
2 305,306 NULL,105
3 307,308 NULL,NULL

I would appreciate if anyone kindly tell me the awk command. Thanks
 
Old 03-16-2014, 03:03 AM   #2
grail
LQ Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 9,252

Rep: Reputation: 2685Reputation: 2685Reputation: 2685Reputation: 2685Reputation: 2685Reputation: 2685Reputation: 2685Reputation: 2685Reputation: 2685Reputation: 2685Reputation: 2685
Tell, no, help you with where you are stuck ... sure

Show us what you have tried and what is not working and we will gladly assist.
You might even try searching the forums as this is not a new solution either.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] awk certain rows sryzdn Linux - Newbie 1 10-06-2013 01:37 AM
awk comparing 2 rows and counting secret Linux - Newbie 7 03-12-2013 09:36 PM
[SOLVED] concatenate 2 variables in dialog using awk while in for loop haraldboehmecke Programming 5 11-25-2011 08:45 AM
How to concatenate rows of 2 files ! noony123 Linux - Newbie 19 04-06-2011 11:11 AM
[Bash] Concatenate string using awk senorsnor Programming 7 05-05-2005 01:38 AM


All times are GMT -5. The time now is 06:21 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration