![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| while loop inside while loop | panknil | Shell Programming and Scripting | 0 | 01-07-2008 09:49 AM |
| For loop | xramm | HP-UX | 3 | 10-10-2007 11:20 AM |
| While Loop | hemangjani | Shell Programming and Scripting | 2 | 11-02-2006 08:01 AM |
| for loop | munnabhai1 | Shell Programming and Scripting | 3 | 04-06-2006 11:30 AM |
| how to get the similar function in while loop or for loop | trynew | Shell Programming and Scripting | 3 | 06-17-2002 08:09 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
I have these following data about 100 row and the data is seperated by a space between each column:
5 4 0 3 7 1 9 8 7 I want to create a while loop that produce the results below: mydata xyz a = 5 b = 0 c = 4 ax(1)=3 bx(1)=7 cx(1)= dx(1)=1 ex(1)= fx(1)= finish finish ax(2)=9 bx(2)=8 cx(2)= dx(2)=7 ex(2)= fx(2)= finish finish Please let me know if you can help!! |
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
Yea, I'm sure someone could help. What the heck is this used for? I can't think of a good reason to snag data like this off the top of my head.
It looks like an interesting homework problem though but you're not providing enough information. I can see why mydata is printed (data file name) and xyz must be the name of the script. If you only have three columns of data though, why are they placed in ax, bx, and dx and what's cx, ex, and fx used for? And why put "finish" at the end of the loop and why twice? It's a puzzle. Carl |
|
#3
|
|||
|
|||
|
the datafile have the following information:
5 4 0 3 7 1 9 8 7 ________________________________________________ This the code: cat datafile | while read datafile do echo anything echo a = $datafile echo b = $datafile echo c = $datafile done ________________________________________________ The results: anything a = 5 4 0 b = 5 4 0 c = 5 4 0 anything a = 3 7 1 b = 3 7 1 c = 3 7 1 anything a = 9 8 7 b = 9 8 7 c = 9 8 7 _____________________________________________ The What I want is: anything a = 5 b = 4 c = 0 anything a = 3 b = 7 c = 1 anything a = 9 b = 8 c = 7 ___________________________________________ How can I do it? CAn anyone help??? Thanks!!! sorry for the confussion! |
|||
| Google The UNIX and Linux Forums |