Stack Overflow for Teams — Collaborate and share knowledge with a private group. Create a free Team What is Teams? Learn more. Linux command to trim a log file Ask Question. Asked 1 year, 10 months ago. Active 1 year, 10 months ago. Viewed times. Improve this question. Surendar Surendar 35 5 5 bronze badges. Please edit your question and show how the output should look like.
I edited the question to make it clear as I understand it based on the comments and the accepted answer.
Please also add the new requirement with the expected output as requested in a comment to the accepted answer. Add a comment. Active Oldest Votes. The question is not fully clear. Improve this answer. Bodo Bodo 4, 12 12 silver badges 24 24 bronze badges. Thanks it worked.. Today's Posts. Quick Links. Search Forums. Show Threads.
Show Posts. Shell Programming and Scripting. Registered User. Join Date: Jun Dear Gurus, Trimming the alert log files of oracle. I need to write a script retaining last 20 lines of the log files and deleting all the other lines I tried with tail , Please help me how to delete all the other lines, my log files has grown upt to 2G.
Thanks in Advance Dave. Join Date: Nov What OS and version are you using? OEL 5. Join Date: Feb The workflow could be: Code :. Thanks for workflow, I am a new bie in linux , I tried with this script in the test environment and worked. I would also like to know is there any alarm when i am executing this script and at the same time if oracle tries to write to this log..
The rotation should be very fast anyway. Output should be like; took ms took ms took ms Log file: Improve this question. Panki 4, 1 1 gold badge 21 21 silver badges 30 30 bronze badges.
Surendar Surendar 35 5 5 bronze badges. Please use the formatting tools to format your log file as code so we can see exactly what it is like. And, as we asked in your previous question, please show us the output you expect from this example. Seems like an answer from your previous question could be adapted rather easily? Add a comment. Active Oldest Votes.
Improve this answer. Community Bot 1. Romeo Ninov Romeo Ninov Sign up or log in Sign up using Google.
0コメント