INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

please help over this

please help over this

(OP)
thread271-1593376: pattern matching lines using the date, and then joining the lines

I am working over a script to scan my log file for current date and if found print the file till end including the found line.

eg:[3/20/14 22:52:25:878 EDT] 0000014a SystemErr R 2014-03-20 22:52:25,878 SEVERE [com.ibm.ws.webcontainer.webapp] - SRVE0293E: [Servlet Error]-[engine]: java.lang.RuntimeException: Failure invoking transactional process 40280ef4-1d44-5120-011d-44518bcd0380.

Like in the above when it comes across 2014-03-20 it sud print the entire lines below it till end including the found line.

could you please suggest an AWK command to do so.
I have tried awk -v mydate="$(date +"%F")" '/mydate/{f=1}f' $FILE > temp.txt
but i am not able to get any output.

RE: please help over this

(OP)
Yes its working...Thanks a lot!!
I have another query. I wana schedule a sh script to run after every 2 hours. Can i do it in any other way except using crontab.
Actually due to some securty reasons crontab funtion is blocked in our environment.
Is it possible?..Please suggest

RE: please help over this

Quote (jaihelsing)

. . .
Actually due to some security reasons crontab funtion is blocked in our environment.
Is it possible?..Please suggest
And you want to bypass security?
What will the Chief Security Officer have to say about it?
thumbsdown

----------------------------------------------------------------------------
The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb

RE: please help over this

(OP)
i don't wanna bypass security.Its just that since that function is blocked was finding another way out.
Actually the crontab function is considered unsecured. To get the permissions from the client and get the crontab functional may take time.
So i thought if some one could help me out finding an alternate to crontab. Which will get my scheduling work done.

RE: please help over this

(OP)
Hi,

Sorry i was out of station for a few days. Could you please explain me the above scripts. Will i not have to crontab this sh script?. how frequent will it run and is there no need to manually run it.??
My requirement is to run it every 2 hours all the days.
Thanks..

RE: please help over this

(OP)
Thanx a lot for the help. Just wanted to clarify since i cannot use crontab. Will manually calling the script once keep it running after every two hours.
Actually my script also includes some mailing of files after awk is performed. Will the mailing also be performed after 2 hours??
Thanks in advance.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close