|
extracting data and store in database
Hello all,
I have this text file data. The data are separated by comma in three column and space or line feed to start a new row
Code:
anderson helberg, Jane, brother
Sister ,mother,grandpa
bombay,new york, china
I would like store them in the following format.
Code:
field1 field2 field3
anderson helberg Jane brother
bombay new york china
my problem is how to implemet the script with both line feed or single space or multiple space and comma separator to separate the rows and stores the data as shown above.
by using cut and delimiter.
Code:
anderson helberg=`echo "$text" | cut -f 1 -d','`
please anyone with help appreciated
|