Sponsored Content
Top Forums Shell Programming and Scripting 2 way to save a log file, what is the difference? Post 303036798 by Neo on Thursday 11th of July 2019 09:31:35 AM
Old 07-11-2019
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:
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Asking on how to save the display log

Hi, like to ask if we try to execute s .sh script and in the script there are sql script and when we run the .sh script only the screen will display out whether it is successful ,those that i did not append to a file will be shown on screen instead of the file. How do i save what ever it... (1 Reply)
Discussion started by: blueberry80
1 Replies

2. Shell Programming and Scripting

To find the time difference between two lines of the same log file

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... (2 Replies)
Discussion started by: satyakam
2 Replies

3. Shell Programming and Scripting

save every line in log file with matched string

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... (3 Replies)
Discussion started by: meggae
3 Replies

4. Shell Programming and Scripting

Save cURL verbose output to file or do it like browser "save as.."

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.... (0 Replies)
Discussion started by: crabmeat
0 Replies

5. Shell Programming and Scripting

cut lines from log file and save it another file

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... (1 Reply)
Discussion started by: tonypalokkaran
1 Replies

6. Red Hat

Need Script to ZIP/SAVE & then DELETE Log file & DELETE ZIPS older than 12 months

ENVIROMENT Linux: Fedora Core release 1 (Yarrow) iPlanet: iPlanet-WebServer-Enterprise/6.0SP1 Log Path: /usr/iplanet/servers/https-company/logs I have iPlanet log rotation enabled rotating files on a daily basis. The rotated logs are NOT compressed & are taking up too much space. I... (7 Replies)
Discussion started by: zachs
7 Replies

7. Shell Programming and Scripting

Save log data in excel sheet

Hello, I have the following data format in a log file : a : x1 b : x2 c : x3 d : x4 -------- a : x5 b : x6 c : x7 d : x8 so the same fields ( a ,b ,c,d) repeated many times in the same log file but with different "x" values (x5,x6,x7,x8). I need a script to save this data in an... (6 Replies)
Discussion started by: mm00123
6 Replies

8. Shell Programming and Scripting

Check/Parse log file's lines using time difference/timestamp

I was looking at this script which outputs the two lines which differs less than one sec. #!/usr/bin/perl -w use strict; use warnings; use Time::Local; use constant SEC_MILIC => 1000; my $file='infile'; ## Open for reading argument file. open my $fh, "<", $file or die "Cannot... (1 Reply)
Discussion started by: cele_82
1 Replies

9. Shell Programming and Scripting

Need Script to ZIP/SAVE & then DELETE Log file & send a mail conformation for any error

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... (1 Reply)
Discussion started by: admin_job_admin
1 Replies

10. Shell Programming and Scripting

Save value from output of Corestat and save in a list for each core

I am trying to modify the "corestat v1.1" code which is in Perl.The typical output of this code is below: Core Utilization CoreId %Usr %Sys %Total ------ ----- ----- ------ 5 4.91 0.01 4.92 6 0.06 ... (0 Replies)
Discussion started by: Zam_1234
0 Replies
buffer_get_token_sa(3)					     Library Functions Manual					    buffer_get_token_sa(3)

NAME
buffer_get_token_sa - read token from buffer SYNTAX
#include <stralloc.h> #include <buffer.h> int buffer_get_token_sa(buffer* b,stralloc* sa, const char* charset,size_t setlen); DESCRIPTION
buffer_get_token_sa appends data from the b to sa until one of the delimiters in charset is found, NOT overwriting the previous content of sa. That delimiter is also appended to sa. If reading from the buffer or allocating memory fails, buffer_get_token_sa returns -1 and sets errno appropriately. At that point sa may already contain a partial token. RETURN VALUE
-1 on error (setting errno), 0 on EOF, 1 when successful. RATIONALE
buffer_get_token_sa appends instead of overwriting so it can be used on non-blocking sockets (these signal error and set errno to EAGAIN; in this case you can simply call buffer_get_token_sa again when select or poll indicate more data is available). SEE ALSO
buffer_getline_sa(3), buffer_get_token(3), buffer(3) buffer_get_token_sa(3)
All times are GMT -4. The time now is 02:20 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy