Home » Infrastructure » Unix » Needs Help
icon13.gif  Needs Help [message #207023] Sun, 03 December 2006 23:16 Go to next message
pulkit_a
Messages: 50
Registered: December 2005
Member
Hi,

I have attached a file and i am looking a way to get some data from this file at through a shell script

In the attached file FHEAD demotes the starting of the file.
Every FHEAD can have multiple THEAD. Every THEAD can have multiple TSHIP and TITEM. At the ebd there will be FTAIL which denotes the end of file.

In every THEAD field like the first mentioned in the file there is a data value like "200612048001" and in this last 4 digits i want to extract from the file. Along with this for all the TITEM comming under THEAD i need to extract a value for example "4901990041416" as in the first TITEM of the file.

Finally i want to create a new file with the combinaiton like


4901990041416 8001
4901990044059 8001
4901990543866 8001
4901990544740 8001
4901990545280 8001
4901990545297 8001
4571116520103 8002
4571116520127 8002
.
.
.
.
and so one

Please let me know if we can write any script for it.

Regards
Pulkit

  • Attachment: Data_file.txt
    (Size: 4.95KB, Downloaded 1369 times)
Re: Needs Help [message #207736 is a reply to message #207023] Wed, 06 December 2006 17:32 Go to previous messageGo to next message
pulkit_a
Messages: 50
Registered: December 2005
Member
Please help me.....if any one can tell me any forum where i can put my request then i will be really very thankfull as this is very cretical and imp for me..

regards
Pulkit
Re: Needs Help [message #207737 is a reply to message #207023] Wed, 06 December 2006 17:34 Go to previous messageGo to next message
andrew again
Messages: 2577
Registered: March 2000
Senior Member
you can use utl_file to read the file line by line ans then just process each line in pl/sql using instr() and substr() to examine the record type and extract the portions you want.
Re: Needs Help [message #207738 is a reply to message #207737] Wed, 06 December 2006 17:38 Go to previous message
pulkit_a
Messages: 50
Registered: December 2005
Member
I will really be greatfull if you can give a sample code....

I was thinking if it can be done through Shell Scripting because finally i have to populate some tables depending upon the list (As i mentioned in my query) that will get generated in a saperate file.

Regards
Pulkit
Previous Topic: unix
Next Topic: How to avoid duplication of Cron Jobs
Goto Forum:
  


Current Time: Fri Mar 29 08:05:08 CDT 2024