The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

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
Split file based on field s_adu Shell Programming and Scripting 6 05-07-2009 02:08 PM
How to split a field into two fields? vbrown Shell Programming and Scripting 4 02-21-2008 06:50 AM
can Awk split my field on the . oly_r Shell Programming and Scripting 6 10-26-2007 07:16 PM
Need to split a large data file using a Unix script SAIK HP-UX 1 03-29-2006 04:05 PM
Split a field in awk script CamTu Shell Programming and Scripting 4 03-21-2005 04:03 PM

 
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 07-21-2009
forumthreads forumthreads is offline
Registered User
  
 

Join Date: Jun 2007
Posts: 18
awk script to split field data

Hi Experts,

I have a Input.txt document which contains data fields seperated by tabs. There are 4 fields totally Named UNIQUE, ORDER, CONTACT and WINS. The UNIQUE field contains unique ID and the CONTACT field contains data seperated by comma in some records. I am looking to write an awk script which will split the CONTACT field values by comma and produce an output file with the split data and Unique ID as shown in the attachement. Any help is appreciated very much.

Many Thanks.

Input.txt
Code:
###########################################
UNIQUE	ORDER	CONTACT	WINS
G001	R01	SP,SD	solution
G002	R01A	B,DR,P	
G003	R02	AF	fix
G004	R03	PO,AC	build 
###########################################
Output.txt
Code:
###########################################
UNIQUE	CONTACT
G001	SP
G001	SD
G002	B
G002	DR
G002	P
G003	AF
G004	PO
G004	AC
###########################################
Attached Files
File Type: txt split.txt (404 Bytes, 27 views)

Last edited by zaxxon; 07-21-2009 at 11:10 AM.. Reason: printed attachment into post - easier to read
 

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 02:12 PM.


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