Dear All,
I have text file like this:
Header
Record 1
Record 2
.......
Record n
Tail
This line of code :
awk '{ if ( NR == 1 ) { head=substr($0,1,300);} else { last = substr($0,1,300);}END{printf "Header is : %-300s Trailer is : %-300s\n", head, last}' filename
converted Header... (11 Replies)
Guys,
My log files stored in the date format format below(log_20080714072942):
TIMESTAMP=`date +%Y%m%d%H%M%S`
LOG=/log/log_${TIMESTAMP}.log
I'm looking for a shell script which deletes all files which is older than 3 months from today.
Regards,
Bhagat (3 Replies)
Hi,
I am trying to write a shell script to delete logs generate by db when space in the folder reaches 70%. i am getting space values from db, find the files at OS and remove them by using a cron job runs every 5minutes.
I have to keep the latest 5 files at any time, my problem is that log files... (3 Replies)
Need to
1. archive all the files in a directory from the previous month into a tar/gz file, ignoring all already archived 'tar.gz' files
2. Check created .tar.gz file isnt corrupted and has all the required files in it. and then remove the original files.
I am using a function to get the... (1 Reply)
I want to use my script to get any file then delete it once it transfers to my side , I manage to create below script to generate "list" file which contains all file names in "10.10.1.1" then I made "a.out" file which contains the commands that I want to run it on "10.10.1.1" to get & delete the... (2 Replies)
Hi
My directory structure is as below.
dir1, dir2, dir3
I have the list of files to be deleted in the below path as below.
/staging/retain_for_2years/Cleanup/log $ ls -lrt
total 0
drwxr-xr-x 2 nobody nobody 256 Mar 01 16:15 01-MAR-2015_SPDBS2
drwxr-xr-x 2 root ... (2 Replies)
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)
Hello All !
I need your help on this case,
I have a csv file with this:
ITEM105;ARI FSR;2016-02-01 08:02;243
ITEM101;ARI FSR;2016-02-01 06:02;240
ITEM032;RNO TLE;2016-02-01 11:03;320
ITEM032;RNO TLE;2016-02-02 05:43;320
ITEM032;RNO TLE;2016-02-01 02:03;320
ITEM032;RNO... (2 Replies)
Hi All,
Do you have any sample script,
- auto get file from SFTP remote server and delete file in remove server after downloaded.
- only download specify filename
- auto upload file from local to SFTP remote server and delete local folder file after uploaded
- only upload specify filename
... (3 Replies)
Discussion started by: weesiong
3 Replies
LEARN ABOUT DEBIAN
log::any::test
Log::Any::Test(3pm) User Contributed Perl Documentation Log::Any::Test(3pm)NAME
Log::Any::Test -- Test what you're logging with Log::Any
SYNOPSIS
use Test::More;
use Log::Any::Test; # should appear before 'use Log::Any'!
use Log::Any qw($log);
# ...
# call something that logs using Log::Any
# ...
# now test to make sure you logged the right things
$log->contains_ok(qr/good log message/, "good message was logged");
$log->does_not_contain_ok(qr/unexpected log message/, "unexpected message was not logged");
$log->empty_ok("no more logs");
# or
my $msgs = $log->msgs;
cmp_deeply($msgs, [{message => 'msg1', level => 'debug'}, ...]);
DESCRIPTION
"Log::Any::Test" is a simple module that allows you to test what has been logged with Log::Any. Most of its API and implementation have
been taken from Log::Any::Dispatch.
Using "Log::Any::Test" sends all subsequent Log::Any log messages to a single global in-memory buffer. It should be used before Log::Any.
METHODS
The test_name is optional in the *_ok methods; a reasonable default will be provided.
msgs ()
Returns the current contents of the global log buffer as an array reference, where each element is a hash containing a category, level,
and message key. e.g.
{
category => 'Foo',
level => 'error',
message => 'this is an error'
},
{
category => 'Bar::Baz',
level => 'debug',
message => 'this is a debug'
}
contains_ok ($regex[, $test_name])
Tests that a message in the log buffer matches $regex. On success, the message is removed from the log buffer (but any other matches
are left untouched).
does_not_contain_ok ($regex[, $test_name])
Tests that no message in the log buffer matches $regex.
empty_ok ([$test_name])
Tests that there is no log buffer left. On failure, the log buffer is cleared to limit further cascading failures.
contains_only_ok ($regex[, $test_name])
Tests that there is a single message in the log buffer and it matches $regex. On success, the message is removed.
clear ()
Clears the log buffer.
SEE ALSO
Log::Any, Test::Log::Dispatch
AUTHOR
Jonathan Swartz
COPYRIGHT & LICENSE
Copyright (C) 2009 Jonathan Swartz, all rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
perl v5.10.1 2009-12-08 Log::Any::Test(3pm)