![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | 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 !! |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| while loop inside while loop | panknil | Shell Programming and Scripting | 0 | 01-07-2008 12:49 PM |
| For loop | xramm | HP-UX | 3 | 10-10-2007 02:20 PM |
| While Loop | hemangjani | Shell Programming and Scripting | 2 | 11-02-2006 11:01 AM |
| for loop | munnabhai1 | Shell Programming and Scripting | 3 | 04-06-2006 02:30 PM |
| how to get the similar function in while loop or for loop | trynew | Shell Programming and Scripting | 3 | 06-17-2002 11:09 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
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!! |
|
||||
|
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 |
|
||||
|
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! |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|