The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
replacing multiple lines with single line siba.s.nayak Shell Programming and Scripting 3 05-28-2008 03:43 AM
Single column to multiple columns in awk astroDave Shell Programming and Scripting 2 03-27-2008 10:00 PM
single column to multiple columns agibbs UNIX for Dummies Questions & Answers 7 12-05-2007 10:04 PM
Reading multiple lines as single braindrain Shell Programming and Scripting 9 10-18-2006 11:16 AM
Splitting a single line into multiple lines thanuman Shell Programming and Scripting 4 02-23-2005 04:56 AM

 
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 12-04-2008
SoMoney SoMoney is offline
Registered User
  
 

Join Date: Dec 2008
Posts: 3
Awk multiple lines with 3rd column onto a single line?

I have a H U G E file with over 1million entries in it.
Looks something like this:

USER0001|DEVICE001|VAR1
USER0001|DEVICE001|VAR2
USER0001|DEVICE001|VAR3
USER0001|DEVICE001|VAR4
USER0001|DEVICE001|VAR5
USER0001|DEVICE001|VAR6
USER0001|DEVICE002|VAR1
USER0001|DEVICE002|VAR2
USER0001|DEVICE002|VAR3
USER0001|DEVICE002|VAR4
USER0001|DEVICE002|VAR5
USER0002|DEVICE003|VAR1
USER0002|DEVICE003|VAR2
USER0002|DEVICE003|VAR3
USER0002|DEVICE003|VAR4
USER0002|DEVICE003|VAR5
USER0002|DEVICE004|VAR1
USER0002|DEVICE004|VAR2
USER0002|DEVICE004|VAR3
USER0002|DEVICE004|VAR4
USER0002|DEVICE004|VAR5
USER0003|DEVICE005|VAR1
USER0003|DEVICE005|VAR2
USER0003|DEVICE005|VAR3
USER0003|DEVICE005|VAR4
USER0003|DEVICE005|VAR5
USER0003|DEVICE005|VAR6
USER0003|DEVICE006|VAR1
USER0003|DEVICE006|VAR2
USER0003|DEVICE006|VAR6


I would like a way to output only the uniq veriables onto a single line like so:

USER0001|DEVICE001|VAR1|VAR2|VAR3|VAR4|VAR5|VAR6
USER0001|DEVICE002|VAR1|VAR2|VAR3|VAR4|VAR5
USER0002|DEVICE003|VAR1|VAR2|VAR3|VAR4|VAR5
USER0002|DEVICE004|VAR1|VAR2|VAR3|VAR4|VAR5
USER0003|DEVICE005|VAR1|VAR2|VAR3|VAR4|VAR5|VAR6
USER0003|DEVICE006|VAR1|VAR2|VAR6


Is this doable with awk or do I need to use perl array?

Last edited by SoMoney; 12-04-2008 at 06:39 PM..
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 09:35 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0