![]() |
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 |
| reading ps command's output line by line | s. murat | Shell Programming and Scripting | 5 | 05-22-2008 05:23 AM |
| Reading the particular line from the file | eamani_sun | Shell Programming and Scripting | 3 | 05-16-2008 05:55 PM |
| reading text file line by line | MizzGail | Shell Programming and Scripting | 6 | 04-14-2008 07:58 AM |
| Reading line by line from a file | tej.buch | Shell Programming and Scripting | 2 | 01-23-2006 02:50 AM |
| Reading line by line from file. | akpopa | UNIX for Dummies Questions & Answers | 4 | 08-30-2001 11:20 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Line by line file reading... and more!
Hello,
I've got a lot of this file replication script written, but I'm having trouble finishing it off. What I need to do at the moment is run through a file one line at a time, execute the line, then check the time. The process cannot run past 7am. I've got a while loop set up to handle the time, I just need the innards of the loop to go through the file one line at a time. The file looks like this: cp /path/to/file /path/to/new/file ...... etc over and over again. Also, if it reaches 7am and the file is not completed, its remaining contents must be saved for the next night. Any help at all would be greatly appreciated. Code:
hour="`date '+%H'`"
while [ $hour -ne "07" ]
do
// read/execute next line of the file
hour="`date '+%H'`"
done
//once it is 7am, save the remainder of the file until the next night.
|
|
||||
|
alternatively you can use this:
Quote:
|
|
|||||
|
Quote:
I already replied with a solution to the previous post: http://www.unix.com/shell-programmin...#post302128241 |
|
||||
|
hey i tried this script
the output is giving like this
PROCEED THE LINE PROCEED THE LINE PROCEED THE LINE PROCEED THE LINE PROCEED THE LINE PROCEED THE LINE PROCEED THE LINE PROCEED THE LINE PROCEED THE LINE PROCEED THE LINE PROCEED THE LINE PROCEED THE LINE PROCEED THE LINE PROCEED THE LINE PROCEED THE LINE PROCEED THE LINE PROCEED THE LINE PROCEED THE LINE PROCEED THE LINE PROCEED THE LINE --------------------------------------------------------------------- the script which i tried and u have given is hour="`date '+%H'`" for filename in `cat input_line` do if [ $hour -ne "07" ] then echo "PROCEED THE LINE" hour="`date '+%H'`" else echo "$input_line" >> not_proceeded_line fi done --------------------------------------------------------------------- can u explain this , what was it doing |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|