03-05-2005
5,
0
Join Date: Mar 2005
Last Activity: 16 March 2005, 7:25 AM EST
Posts: 5
Thanks Given: 0
Thanked 0 Times in 0 Posts
txt file to oracle database
hiya,
i have a query: i want to read a file which contains:
2005/02/21 16:56:54.301: 111 PS (200, 10) sent <log instrument="FXA.ROSS" name="FXA.COSS.PAH.URR"><gid_id>1434025</gid_id><submit_id>22</submit_id><taker_name>shannop2</taker_name><taker_group_name>SupportClients/SupportUsers</taker_group_name><taker_account>Demo
2005/02/21 16:56:55.596: 111 PS (200, 10) sent <log instrument="FXA.ROSS" name="FXA.ROSS.PUR.URR"><gid_id>1534025</gid_id><submit_id>22</submit_id><taker_name>shannop2</taker_name><taker_group_name>SupportClients/SupportUsers</taker_group_name><taker_account>Demo
Now i want to grep just the timestamp (ie 16:56:54.301) & the gid_id (ie 1434025) in the first line & so on for all lines. Then insert this into a oracle database.
what i have done is i use the cut command to first cut the timestamp on each line & write to a file , then do the same with the gid_id. Finally paste the two files. It looks like this.
file1 : jo.txt
16:56:54.301
16:56:55.596
file2: jo1.txt
1434025
1534025
After paste, file3: jo3.txt
16:56:54.301 1434025
16:56:55.596 1534025
Question 1: is there an easeier way to do this?
Question 2: i want to read file3 (ie jo3.txt) & insert the contents into an oracle table
To do this, should i count the no. of lines in file3 (ie jo3.txt) using wc -l & then using a for loop connect to db using the sql -s user/passwd@server<<++>/dev/null & use the insert command?
would be great if i could get suggestions on this...plz
cheers,
Jo