The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



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

 
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 03-31-2009
jermaine4ever jermaine4ever is offline
Registered User
  
 

Join Date: Mar 2009
Posts: 21
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
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 08:34 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0