The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Please Help Me Guys zanetti321 UNIX for Advanced & Expert Users 8 03-02-2008 11:15 AM
Hi guys... vinayraj UNIX for Advanced & Expert Users 1 02-07-2008 11:37 PM
Thanks guys b_manu78 AIX 0 01-03-2006 06:43 AM
Hi again guys M_Hafez UNIX for Dummies Questions & Answers 1 01-16-2005 11:48 AM
i need your guys help souldier UNIX for Advanced & Expert Users 21 03-29-2002 07:26 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 02-10-2009
games_icon games_icon is offline
Registered User
  
 

Join Date: Feb 2009
Posts: 1
Please help me guys...

Hi All!

I need to write a script which reads a file and tries to insert into the DB using those values...

file format:
var1 var2 var3
var4 var5 var6

Now I want to read from the above file and trying to insert like...
insert into table1 values( var1, var2, var3 );
in a loop to cover all rows in the file...

Please help me guys... from yesterday its killing me...
  #2 (permalink)  
Old 02-10-2009
Ygor's Avatar
Ygor Ygor is offline Forum Staff  
Moderator
  
 

Join Date: Oct 2003
Location: -31.96,115.84
Posts: 1,411
See...

how to insert data in database based on text file?
  #3 (permalink)  
Old 02-10-2009
rakeshou rakeshou is offline
Registered User
  
 

Join Date: May 2007
Posts: 75
Try this

Quote:
Originally Posted by games_icon View Post
Hi All!

I need to write a script which reads a file and tries to insert into the DB using those values...

file format:
var1 var2 var3
var4 var5 var6

Now I want to read from the above file and trying to insert like...
insert into table1 values( var1, var2, var3 );
in a loop to cover all rows in the file...

Please help me guys... from yesterday its killing me...
cat file| tr ' ' ',' | awk '{print "insert into <tablename> values (" $0 ")" }'
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 03:44 AM.


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