![]() |
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 |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| A basic question of FOR loop | er_ashu | UNIX for Dummies Questions & Answers | 3 | 09-28-2007 11:41 AM |
| while loop question | stepnkev | Shell Programming and Scripting | 2 | 06-01-2007 10:51 AM |
| oracle and loop question | pavan_test | UNIX for Dummies Questions & Answers | 4 | 09-29-2006 12:23 AM |
| Simple while loop question | Brokeback | Shell Programming and Scripting | 3 | 07-21-2006 10:04 AM |
| foreach loop question | clipski | UNIX for Dummies Questions & Answers | 7 | 12-22-2005 01:28 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread |
Rating:
|
Display Modes |
|
|
|
||||
|
Loop question
hi,
how would i go about making a loop which gets each line from a single text file, set it to a variable and then print it to screen? thanks eg: Code:
#!/bin/sh FILE="somefile.txt" text_line="" what kind of loop would use here? |
|
||||
|
How abt this........
#!/bin/sh FILE="somefile.txt" COUNT=0 #Storing in a array while read LINE_FROM_FILE do TEXT_LINE[$COUNT]=$LINE_FROM_FILE COUNT=`expr $COUNT + 1` done < $FILE I=0; #Printing the array while [ $COUNT -ne 0] do echo ${TEXT_LINE[$I]} I=`expr $I + 1` COUNT=`expr $COUNT - 1` done Thanks Om |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|