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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Get the value from a .csv files 1

Status
Not open for further replies.

ajayarora

Programmer
Jun 5, 2003
24
0
0
CA
Hi,

My requirement is to get the arguments for a stored proc from a .csv file. Only problem in getting the arguments is the spaces in between the values.e.g.the file is like
123,first name,last name,1000
arg1=123
arg2=first name
arg3=last name
arg4=1000.

Any help on this would be appreciated.

Thanks
Ajay.


 
Try this:
Code:
(IFS=","; while read arg1 arg2 arg3 arg4; do
 echo "1='$arg1' 2='$arg2' 3='$arg3' 4='$arg4'"
done)</Path/to/file.csv

Hope This Help
PH.
 
Many Thanks.
What if I just want to extract the first three parameters?
Actually in that case your script displays 3=last name,1000.

Regards
Ajay.

 
You have to read at least 4 parameters. Simply ignore the value of $arg4 inside the read loop.

Hope This Help
PH.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top