Capture Value from file


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users Capture Value from file
# 1  
Old 08-28-2006
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  
Old 08-28-2006
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.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

String capture from ip file

Dear All From below mention input file I want op file as mention. Kindly help. IP file: "BSCGNR4_IPA17_C" 329 140119 0717 RXOCF-105 KJO001_BASC_NG AC FAULTY DG ON DOOR OPEN Needed OP: 140119 0717 KJO001_BASC_NG AC FAULTY DG ON DOOR OPEN Note that string mark in red as variable in... (3 Replies)
Discussion started by: jaydeep_sadaria
3 Replies

2. Shell Programming and Scripting

Capture specific fields in file

Dear Friends, I have a file a.txt 1|3478.12|487|4578.04|4505.5478|rhfj|rehtire|rhj I want to get the field numbers which have decimal values output: Fields: 2,4,5 Plz help (6 Replies)
Discussion started by: i150371485
6 Replies

3. UNIX for Dummies Questions & Answers

Capture filenames with a Pattern into another file

Hi i have a command in windows which captures the filenames with the same pattern and route it to another file. for example filetest_20110921, filetest_20110922,filetest_20110923 etc I would like to know the command in UNIX/LINUX for the same. The command which i am using in Windows is ... (12 Replies)
Discussion started by: mansurkhalil
12 Replies

4. Shell Programming and Scripting

Capture first N Bytes from first line in a file

Hi Guyz, I need to capture first N Bytes from the first line of my file. Eg. If i have following data in File1 414d51204541495052475731202020204a910846230e420c Hello 3621363663212 Help Required Then, i want the value of first 48 Bytes to be stored in a variable. That is, variable... (5 Replies)
Discussion started by: DTechBuddy
5 Replies

5. Shell Programming and Scripting

capture the last file when you don't know the all name

I have to ftp a file from a directory in Windows, I need to be able to ftp the last file that was put in the directory, the only thing I know about that file is that the 4 first digits are always the same (3520) then it is a _5(more digits), random digits, so it will be something like this... (1 Reply)
Discussion started by: rechever
1 Replies

6. Shell Programming and Scripting

capture output of file and send last string thereof to new file

Hello, If I run a program from within shell, the output is displayed in the command line terminal. Is there a way I can capture that output and choose only the very last string in it to send it to a new file? Thank you (6 Replies)
Discussion started by: Lorna
6 Replies

7. Shell Programming and Scripting

Capture data in a file

How to capture the rows in a file after executing the store procedure using the perl scripts? (0 Replies)
Discussion started by: vinay123
0 Replies

8. Shell Programming and Scripting

Script to capture new lines in a file and copy it to new file

Hi All, I have a file that gives me new line/output every 5 minutes. I need to create a script that capture new line/output besides "IN CRON_STATUS", in this case the new output is "begin ------ cron_status.sh - -----------". I want this script to capture the line starting from "begin ------... (0 Replies)
Discussion started by: fara_aris
0 Replies

9. Solaris

capture ping to a file

I would like to capture the output from ping into a file. I am on solaris 9. I can get the basic "server is alive" command in a file, but I want the response from ping -s into a file. I am going to schedule this in cron to run at certain times during the day. When I run the ping -s in a... (3 Replies)
Discussion started by: MizzGail
3 Replies

10. Shell Programming and Scripting

capture the file name

I am trying to capture the file name(which is not of fixed length) and put it in a variable. It is working in unix whereas when I am running the same script in Informatica it is not giving me the desired output. But when I comment the option(find the file name) then it is working fine. It can... (4 Replies)
Discussion started by: Mandab
4 Replies
Login or Register to Ask a Question