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
Paste Command does not align my output jplayermx Shell Programming and Scripting 4 09-05-2008 03:03 PM
Align Text from a file. earlepps UNIX for Dummies Questions & Answers 9 08-01-2006 09:37 AM
align several fields and fill spaces with zero DebianJ Shell Programming and Scripting 2 11-23-2005 07:51 AM
how to align report headers in awk galinaqt Shell Programming and Scripting 3 10-16-2005 04:41 PM
How to underline/bold and how to align output clara UNIX for Dummies Questions & Answers 1 06-16-2005 01:41 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 05-27-2009
chowdhut chowdhut is offline
Registered User
  
 

Join Date: May 2009
Location: CT, USA
Posts: 4
To Align clinical data files using awk

Hello, I am new to shell scripts and 1st week into awk. I have so far managed to format output files to sample File 1 and File 2 as shown below and File 3 output solution is what I am looking for...thanks

File 1:
0633-009_001200008:225065338468009:CMBRTRM:albuterol
0633-009_001200008:225065338468009:CMCLAS1:respiratory system
0633-009_001200008:225065338468009:CMCLAS2:drugs for obstructive
0633-009_001200008:225065338468009:CMCLAS3:adrenergics
0633-009_001200009:225065338468008:CMBRTRM:albuterol
0633-009_001200009:225065338468008:CMCLAS1:respiratory system
0633-009_001200009:225065338468008:CMCLAS2:drugs for obstructive
0633-009_001200009:225065338468008:CMCLSCD3:R03C
File 2:
USUBJID|CMSEQ|CMBRTRM|CMCLAS1|CMCLAS2|CMCLAS3|CMCLSCD1|CMCLSCD2|CMCLSCD3|CMROUTE|
0633-009_001200008|225065338468009
0633-009_001200009|225065338468008

Need Output File 3 with Conditions:
File 1's Field 4 values ( seprated by ":" for example albuterol) appends to File 2 by
Field 3 value of File 1 ( for example CMBRTM) equals File 2 header separeted by | ( for example |CMBRTM|) and
for that row of insert File 2's field 1 and field 2 values is equal to File 1's field 1 and 2 values


Out put File 3:
USUBJID|CMSEQ|CMBRTRM|CMCLAS1|CMCLAS2|CMCLAS3|CMCLSCD1|CMCLSCD2|CMCLSCD3|CMROUTE|
633-009_001200008|225065338468009|albuterol|respiratorysystem|drugs for obstructive |adrenergics |||||
0633-009_001200009|225065338468008|albuterol|respiratory system|drugs for obstructive||||R03C||
 

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:49 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