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

Split string into induvidual variables

Status
Not open for further replies.

Trancemission

Technical User
Oct 16, 2001
108
GB
I am looking to split a sentance up into induvidual variables for each word. Ie I have a file like below:

CustomerA 4
CustomerB 5
CustomerC 6

The fields are seperated by tabs.

I am lookup to take a line and get the two variables. Example for 1st line:

$1 = CustomerA
$2 = 4

I have been puling my hair out all day trying to get this to work so help will be appricated.

Marcus
 
how are you "taking a line" ? Is this STND input or reading this from a file?

crowe
 
ksh

while read V1 V2
do
printf "V1='%s' V2='%s'\n",V1,V2
done # if lines are read from file, add <file
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top