Transfer data from one file to another


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Transfer data from one file to another
# 1  
Old 01-05-2009
Transfer data from one file to another

Hi,
I'm relatively new to shell scripting, Ive worked on a few basic scripts and used most of the unix commands in the simplest of situations. But I am now faced with a task that's seems to be beyond me.

I have a file with some data in the form of rows and columns :

123 4536 abcd4 677 bbb ggg nnn 32425
343 5656 abcd6 566 eee fff ooo 56454
343 5645 abcd7 556 ddd lll jjj 43536....
.
.
.
and so on

I need a shell script to pick this data and put it into an insert command which lies in another text file.The insert command would be in the form insert into table_xyz values ($a,'$b','$c',etc) where the variables would be the values from the above mentioned data file. the output of the script should be as many insert statements as there are lines in the data file.As in,
insert into table_xyz values(123, 4536, 'abcd4', 677, 'bbb', 'ggg', 'nnn' ,32425)
insert into table_xyz values(343, 5656, 'abcd6', 566, 'eee', 'fff', 'ooo' 56454) etc

Some sort of script to store the data in an array or something and iterate through it?Any help,advice would be greatly appreciated...

Thanx in advance
# 2  
Old 01-05-2009
No duplicate or cross-posting, please read the rules.

Continue here:

https://www.unix.com/shell-programmin...#post302273504

Thread closed.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Red Hat

Data transfer in Linux

Please let me know which ports are used for data transfer, as per my understaning in Linux below ports are used for data transfer from windows to Linux. ftp 21 sftp 22 (Most secure Port) telnet 23 any other port? wheather we can change the port no 22 to any other port no for a... (10 Replies)
Discussion started by: manoj.solaris
10 Replies

2. Red Hat

Data transfer Time calculation

1 TB of data needs to read through 4 I/O channesl, each channels supports - 100 MB/s, What is average time taken to read the data ? Please give the formula for my understanding (2 Replies)
Discussion started by: Srini.rk1983
2 Replies

3. Windows & DOS: Issues & Discussions

DEC 2000 Data Transfer to PC

Hello - My first post here. I did some looking around; wasn't sure where to jump in or if something like this has been covered. I have a DEC 2000 Alpha that was turned off probably 6 years ago once I had made the transition of programs and most files to the desktop PC. I have the idea... (4 Replies)
Discussion started by: KSchrader
4 Replies

4. UNIX for Dummies Questions & Answers

Data transfer to excel

i have two excel sheets with cpu uasge and memory usage in the follwing format: sheet 1: 22,33 sheet 2: 55,66 i need to display in the below format: servername cpu mem ser1 22 33 ser2 55 66 am using UNIX os. can anyone help me... (2 Replies)
Discussion started by: arunmanas
2 Replies

5. Solaris

Data Transfer

We have a data on the disk that was copied from HP N4000 running HPUX 11.11 and it was created with vxfs version 4. We need to transfer this data to Sun server, how might this be done? (2 Replies)
Discussion started by: Kjons76
2 Replies

6. SCO

data transfer from serial port

dear sir, pls. can you help me ? , my os is unix sco 5.0.4 and ,server dat derive (1,4gb) not working, now i want to transfer my server data in other machine (unix/other possible) by serial port/other port comminication. thanks pankaj raval (2 Replies)
Discussion started by: pankajbraval
2 Replies

7. AIX

FTP - Data Transfer Limitations.

Hi, I have to transfer data from our production site to DR site(another city). I am using FTP for transfering data. But I am unable to get the same data transfer rate on AIX machines, one I am geting on windows machines. I want to know, is there any constraint on data transfer using FTP on AIX... (2 Replies)
Discussion started by: system-admin
2 Replies

8. Solaris

transfer data to a remote system from the tape

i need to retrieve the data from tape on to a remote system.how should i go about it can anyone please help.......its urgent (1 Reply)
Discussion started by: jack123
1 Replies

9. UNIX for Advanced & Expert Users

data corruption with ftp transfer

Hi again, first of all thanks for you help on my last problem, the problem is solved now. But I have many problem :) This time, I transfered a big file, ~3,5 GByte, with ftp from a Sun machine to a linux box, RedHat 7.3. But the file recieved on the Linux Box is corrupt, with smaller files... (12 Replies)
Discussion started by: malcom
12 Replies

10. UNIX for Dummies Questions & Answers

How much data will transfer at 100 full

I am trying to determing how long it will take to transfer 384 Gb of data across a 100 Mb full ethernet. If I am correct, I come up with 36 Gb per hour. Surely that is not correct. I assumed 100 megabit per second is 10 megabyte per second, which is 600 megabytes per minute and 36 GB per hour.... (3 Replies)
Discussion started by: 98_1LE
3 Replies
Login or Register to Ask a Question