Today (Saturday) We will make some minor tuning adjustments to MySQL.

You may experience 2 up to 10 seconds "glitch time" when we restart MySQL. We expect to make these adjustments around 1AM Eastern Daylight Saving Time (EDT) US.


2 way to save a log file, what is the difference?


Login or Register to Reply

 
Thread Tools Search this Thread
# 1  
2 way to save a log file, what is the difference?

Hello good day

I would like to know what is the difference between these two commands please
both warrant the output in the file

Code:
echo " ORACLE_SID   : $ORACLE_SID"     | tee -a $logfile

echo " ORACLE_SID   : $ORACLE_SID"     > $logfile

# 2  
The -a options of tee appends the output to the file rather than overwriting the file.

Your > $logfile code overwrites the file.

There may be more subtle differences I am not familiar with off the top of my head.
This User Gave Thanks to Neo For This Post:
# 3  
tee works like a plumber's T-piece that allows gas or water flow split into two directions. tee accepts input on stdin and, on top of writing it to stdout, also writes / appends to one or several additional files. Your first version will append to a log file (create if non-existent) but also print to screen (or whatever stdout is at the time the snippet runs).
This User Gave Thanks to RudiC For This Post:
Login or Register to Reply

|
Thread Tools Search this Thread
Search this Thread:
Advanced Search

More UNIX and Linux Forum Topics You Might Find Helpful
Need Script to ZIP/SAVE & then DELETE Log file & send a mail conformation for any error
admin_job_admin
ENVIROMENT Linux: RHEL 6.4 Log Path: /usr/iplanet/servers/https-company/logs Log Format: user.log.03-15-2015 I have log4j log rotation enabled rotating files on a daily basis. The rotated logs are NOT compressed & are taking up too much space. I need a script that will run daily that...... Shell Programming and Scripting
1
Shell Programming and Scripting
cut lines from log file and save it another file
tonypalokkaran
Dears, i want cut the lines from a log file. Example of the log file as follows.. May 27, 2011 5:54:51 PM com.huawei.ivas.utilities.sm.client.SMDeliverContrUtil isDeliverSM FINE: May 27, 2011 5:54:51 PM com.huawei.ivas.utilities.sm.client.SMUtil addSysUpMsgLog INFO: . The message content...... Shell Programming and Scripting
1
Shell Programming and Scripting
Save cURL verbose output to file or do it like browser "save as.."
crabmeat
hi there ! i have exactly the same problem like this guy here https://www.unix.com/shell-programming-scripting/127668-getting-curl-output-verbose-file.html i am not able to save the curl verbose output.. the sollution in this thread (redirecting stderr to a file) does not work for me....... Shell Programming and Scripting
0
Shell Programming and Scripting
save every line in log file with matched string
meggae
i have been doing this script to match every line in a current log file (access_log) with strings that i list from a path (consist of 100 of user's name ex: meggae ).. and then make a directory of every string from the text file (/path/meggae/) --->if it matched.. then print every line from the...... Shell Programming and Scripting
3
Shell Programming and Scripting
To find the time difference between two lines of the same log file
satyakam
Hello Friends, I want to write a script for the following: nlscux62:tibprod> grep "2008 Apr 30 01:" SA_EHV_SPEED_SFC_IN_03-SA_EHV_SPEED_SFC_IN_03-2.log | grep -i post | more 2008 Apr 30 01:01:23:928 GMT +2 SAPAdapter.SA_EHV_SPEED_SFC_IN_03-SA_EHV_SPEED_SFC_IN_03-2 Info AER3-000095 IDOC...... Shell Programming and Scripting
2
Shell Programming and Scripting

Featured Tech Videos