Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

4 log files are produced by 1 scrip

Status
Not open for further replies.

maxcrook

Programmer
Jan 25, 2001
210
GB
4 log files are produced by 1 script that runs on one of my aix boxes,the log files are numbered sequentially and start as follows.

1234.LOG
1235.LOG
1236.LOG
1237.LOG
I have a script that checks one log at a time.
However I want the user to type in the 1st log
ie. 1234.LOG and then check the remaining 3 logs without the user entering 4 separate log numbers.The result would then be output to the screen.
 
Seems you like making work :)

Why not change the script so it only outputs one log ?

Alex
 
Something like (quick and dirty)?:

pg $1.log #(where $1 is the user-supplied first number)
COUNT=1
NEXT=$1
while [ $COUNT -le 3 ]
do
NEXT=`expr $NEXT + 1`
pg $NEXT.log
COUNT=`expr $COUNT + 1`
done

Hope this helps.
 
The script is hard coded.Therefore im not able to change the output to 4 logs.

I have tried the script above and it does exactly what i want it to do.

Thanks

Max
 
Apologies - Have not looked at the output of this and it only searches the 1st LOG. Is there something missing ?
 
Max, this is the first mention of 'searches' in this thread. Can you clarify exactly what you mean, please? Are you searching for a specific string, for example? Cheers.
 
OK. If I'm reading this correctly now, you want the hard coded script to pick up the sequential numbers too?

If so, take out the pg $NEXT.log line and replace it with:

<name of your checking script> $NEXT.log

Note that this assumes that your hard coded script accepts the file name as it's parameter.

If this is an incorrect interpretation, let me know and we'll see what we can do. Cheers.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top