Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

read and post to MySQL

Status
Not open for further replies.
Apr 27, 1999
705
US


Hello,

I'm familiar with VBscript but need a script for UNIX that reads a file. The first line has fifty fields and is comma delimited. Is there a split function that reads this line into an array.

I then need to do an INSERT into MySQL database. Your help is greatly appreciated.

fengshui1998
 
man awk

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Hi

A [tt]bash[/tt] only way to spread comma ( , ) separated values across an array :
Code:
[blue]master #[/blue] line="zero,one,two,three,four"

[blue]master #[/blue] IFS=,

[blue]master #[/blue] array=($line)

[blue]master #[/blue] echo ${#array[*]}
5

[blue]master #[/blue] echo ${array[3]}
three

Feherke.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top