The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

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




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #2 (permalink)  
Old 01-05-2009
summer_cherry summer_cherry is offline Forum Advisor  
Registered User
  
 

Join Date: Jun 2007
Location: Beijing China
Posts: 1,088
hi below perl script may help you some
Not sure whether your column is in fixed length, if yes, can remove those trim( and ), and the number of < indicate the length of your value, so make sure use the longest < for all of them depending on your longest column value.


Code:
format TOP=
insert into table_xyz values(@<<<<<,@<<<<<,trim('@<<<<<<'),@<<<<<,trim('@<<<<<'),trim('@<<<<<'),trim('@<<<<<<'),@<<<<<<);
$a $b $c $d $e $f $g $h
.
$~=TOP;
open FH,"<a.txt";
while(<FH>){
	($a, $b, $c, $d, $e, $f, $g, $h)=split(" ",$_);
	write;
}
close FH;