the last two weeks have been very educational... I went through a bunch of websites about linux and its commands.. still not have mastered it nor its many operators ... and symbols. I wish I had more time to dig to the next and unix.com but I m on a deadline for this project.
I have a file with many lines like the following
So the pattern is
Well heres what I am told to do... I
When this script is run it should check each line and compare that line's Epochtime with the current Epcohtime. If 15 mins have passed by then it should increase count value by 1. II
It should check the count value and if its mod (count/5) is qual to '0'. [ eg if (mod(count/5) == 0) ]
If false increase the count value by 1
If true then I have to send mail to abc.def@xxx.com. Telling which 'from' and 'to' mail address 'combination' is still in the Q.
I have no idea how to use the ^ / $ or any other operator. Any help will be appreciated.
Thanks
For I:
Store the current time in a variable, compare the current time and the time on the file using an if loop, based on the result set the counter value to 1 more.
Please explain the format of the first field of the text assuming it is the time in the input file and the counter operation as there are 2 ways of it working in I & II.
I dont know how to extract string from the line mentioned. Could you tell me how to do it. so that i could store it in variable eg
VAR1 = Epochtime
VAR2 = Count.
Also i dont know how to replace the count in the line after it had been increased by 1.
The first set of numbers u see is the epoch time of the time that line is created.
I was thinking of running something like
This is a rough idea of how i imagine the logic to be . The pboblem I face is how to extract the values to a variable and how to insert back to the respective line and continue on for each line of the file. This is primitive any optimizing will be helpful.
Epoch time is the representation of time in seconds by the linux system.
How can I validate if time (HH:MM:SS) argument is valid? I got this from web but I can't modify it to exit the script if the time argument is invalid.
echo $1 | awk -F ':' '{ print ($1 <= 23 && $2 <= 59 && $3 <= 59) ? "good" : "bad" }'
ex:
./script.ksh 12:34:21 = okay
./script.ksh... (10 Replies)
Hi Frnds,
i have a folder test in which files generated daily how to chek the files that are modified on that day as a condition for ex,
if
then echo "i have got something to do with the file"
else
echo" sorry"
fi
i will have more than 3 to 4 files that are modified today. and if... (5 Replies)
Hi,
I need help to read file in a directory on basis of time stamp.
e.g. If file access in last 2 minutes it should not be copy to remote directory.
Below is my script.
#!/bin/ksh
DATE=`date +"%Y-%m-%d_%H%M"`
SEPARATER=" "
exec < out_interfaces.cfg
while read source_path... (10 Replies)
How can i do something, that will be doing periodicaly for 24 hours
and then do something else.
For example:
i want to write "time" in a text file every 10 sec
but only for the next 24 h and then rewrite all that data to an other file,
then again write "time" in the first file every 10 sec,... (5 Replies)
I am attempting to figure out how to do a time check within my script.
For some reason I can not seem to get this to work correctly.
I want the script to first see if it is Saturday.
If it is Saturday then check to see if it's between the time 5:30am and 6:30am.
If it is between 5:30am and... (4 Replies)
I have two servers which are not in sync.
I need to write a script that checks the time on the corresponding server and another script to call the above script on both the servers simulataneously to check if there is a time difference.
Can anyone provide me with such scripts as I am new to... (3 Replies)
HI! All
Iam facing an issue with split comman in unix
Prifix=Z_PRICE_NEW`date "+%Y%m%d%H%M%S"`
split -5000 Product.txt $Prifix
find . -name "$Prifix*" -print | {
while read FILE;
do
mv $FILE $FILE.txt
done
}
when is execute the comman the command is working fine and generating the... (2 Replies)
respected sirs,
how to increase the logout time in unix...... at present when we r idle for 5 min...... the system is responding with login again.......and the other problem how to add an operator ........plz help to solve my queries
thanking u sir
... (1 Reply)