![]() |
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 |
| how to insert data into database by reading it from a text file?? | pallavishetty | Shell Programming and Scripting | 4 | 10-30-2008 08:02 AM |
| Adding specific text and spaces to each line in a text file | hertingm | Shell Programming and Scripting | 4 | 08-25-2008 02:34 PM |
| reading text file line by line | MizzGail | Shell Programming and Scripting | 6 | 04-14-2008 06:58 AM |
| jumping to a specific line in a text file | mridula | High Level Programming | 4 | 09-20-2005 01:49 AM |
| reading specific line from file | cool_boss2121 | Shell Programming and Scripting | 10 | 04-26-2005 09:05 PM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Reading data from a specific line in a text file
Hello,
I have a problem which is giving me headache for days, can some please help. Please see code and text fiel below. Please see text in red for the problem I am facing # Program gets an input x from user while read line ; do echo $line | read a b c d if [ "$x" = "$a" ] ; then ( IFS=- printf ' 1\n 1\n 0\n 0\n' printf ' %s\n' $b printf ' 1\n 7\n 0\n' printf ' %s\n' $c # if $b (second row in the text file below) is > 1, I want the code to go to the next line and print the $c and increment a counter until counter equals $b and then move to the next set of code below printf ' 1\n 1\n 0\n 0\n 0\n N\n 1\n 100\n' ) | "$LOTO"/bin/loto_tsim > /dev/null 2>&1 else SOMETHING fi done < LottWagers2.txt # Text file data is sent to the while loop TEXT FILE ============================================ 1 3 02-01-27-28-29-30 (99) Both 1 0 1 01-31-32-33-34-35 (99) Both 3 0 1 03-06-09-10-20-21 (99) Both 3 2 1 05-31-32-33-34-35 (99) Both 3 2 1 06-07-09-10-20-21 (99) Both 3 4 1 05-07-08-09-10-25 (99) Both 4 4 1 01-02-10-11-24-25 (99) Both 7 4 1 01-02-31-32-33-34 (99) Both 5 4 1 02-04-31-32-33-34 (99) Both 5 4 1 06-02-09-10-20-21 (99) Both 3 |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|