![]() |
|
|
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 |
| Using Shell Script to get data from text file | jermaine4ever | Shell Programming and Scripting | 1 | 03-13-2009 08:58 PM |
| extracting text and reusing the text to rename file | JohnDS | UNIX for Dummies Questions & Answers | 7 | 02-05-2009 03:55 AM |
| urgent-extracting block data from flat file using shell script | shirish_cd | Shell Programming and Scripting | 4 | 02-06-2008 09:05 AM |
| Extracting data from text file based on configuration set in config file | suparnbector | Shell Programming and Scripting | 3 | 08-10-2007 03:25 AM |
| Need Shell Script to upload data from Text file to Oracle database | chandrashekharj | Shell Programming and Scripting | 6 | 03-26-2007 04:21 AM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Script extracting the incorrect data from text file
Hello,
A script has been written to extract a specific column data from a text file ONLY if the user's initial input matches the the data of the first column in the text, then only the data from that row will be prinited. The problem I am having is that the code is only reading the records highlighted in red from the text file. It should only read the lines where the first column matches the user’s input. CAN ANYONE HELP? ===================Shell Script======================= #!/bin/sh print 'Please enter the Test Day or 0 for all days: ' read x while read line do read a b c d if a==x then ( IFS=- printf ' 1\n 20\n 0\n 0\n 1\n 1\n 7\n 0\n' printf ' %s\n' $c 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 print 'X is now equals to : ' $x print 'First Col equals to : ' $a print 'Your wager is: ' $c fi done < LottWagers2.txt ============= LottWagers2.txt ============= 1 1 01-02-27-28-29-30 (99) Both 1 1 1 01-31-32-33-34-35 (99) Both 3 2 1 01-06-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 |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|