The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Advanced & Expert Users
.
google unix.com



UNIX for Advanced & Expert Users Expert-to-Expert. Learn advanced UNIX, UNIX commands, Linux, Operating Systems, System Administration, Programming, Shell, Shell Scripts, Solaris, Linux, HP-UX, AIX, OS X, BSD.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Script to capture new lines in a file and copy it to new file fara_aris Shell Programming and Scripting 0 05-27-2008 11:11 PM
capture ping to a file MizzGail SUN Solaris 3 09-20-2007 10:31 AM
capture the file name Mandab Shell Programming and Scripting 4 05-29-2007 11:22 AM
Capture the command run in the log file ahmedwaseem2000 Shell Programming and Scripting 4 08-09-2006 02:06 PM
capture nohup log file mgirinath Shell Programming and Scripting 2 04-24-2006 05:51 PM

Closed Thread
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
  #1 (permalink)  
Old 08-28-2006
kris01752 kris01752 is offline
Registered User
  
 

Join Date: Aug 2006
Posts: 17
Capture Value from file

I have a file in the following Format

Fundid: 100-BankA

AccountNumber Balance
1 200
2 300
3 400


FundId:123321-BankB

AccountNumber Balance
1 200
3 100


...........

I can have N number of funds.

The final file should be one file having all funds data having three columns with Fundid being the third column

Any inputs how to do this


Thanks
  #2 (permalink)  
Old 08-28-2006
blowtorch's Avatar
blowtorch blowtorch is offline Forum Advisor  
Supporter
  
 

Join Date: Dec 2004
Location: Singapore
Posts: 2,350
Try this:

Code:
awk -F':' '!/^$/&&!/Account/ {if($1=="FundId") awkfundid=$2; else print $0,awkfundid}' filename_to_process

Note that I am assuming that the word 'FundId' will always have uppercase F and I.
Closed Thread

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 04:57 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