Sponsored Content
Top Forums Shell Programming and Scripting rename file to file.ext.datetime Post 302136954 by liketheshell on Thursday 20th of September 2007 04:12:00 PM
Old 09-20-2007
Try this

$mv error.log error.log.`date '+%Y%m%d_%H%M'`
error.log.20070920_1607
 

8 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

DateTime Format Conversion in a File

Hi Pals. I have a file which is in the below format. 2007/10/15-12:04:24,'CRLift','TH-42PX75U','BestBuy','W01P0207',22,15,'User1' 2007/10/15-12:04:26,'CRLift','TH-42PX75U','BestBuy','W01P0207',22,15,'User2' 2007/10/15-12:04:29,'CRLift','TH-42PX75U','BestBuy','W01P0207',22,15,'User3'... (4 Replies)
Discussion started by: srikanthgr1
4 Replies

2. Shell Programming and Scripting

Shell script to rename files with .1,.2,.3 ....ext respectively

Hey Guys.... Just need some help as I am not proficient in Unix shell script... Doubt: --------------- Suppose there will be some of the following files inside a directory called OUT ... Path: - /appdb1/product/batch/rms/OUT files inside OUT directory:- POSU_75002_20090127_20090129035442... (4 Replies)
Discussion started by: satyajit007
4 Replies

3. UNIX for Advanced & Expert Users

shred() not working on ext* file systems

When vfat format my128kb flash drive, shred works fine. But, when I format it using ext2 or ext3, shred() exits with this error: shred: /dev/sdb1: pass 1/1 (random)... shred: /dev/sdb1: error writing at offset 12288: Invalid argumentAnyone know what is going on? (0 Replies)
Discussion started by: codecellar
0 Replies

4. UNIX for Advanced & Expert Users

Rename a file to a file_current datetime in a shell script

Hi all, Could anyone suggest me on Renaming a file to a file_current datetime in a shell script. (3 Replies)
Discussion started by: Nithin
3 Replies

5. Shell Programming and Scripting

.sh file To rename existing file and copy new file

Hi All, I am very new to shell scripting . In my current task i want to create .sh file that will rename the existing file with appending _bu in it. And then copy new file . e.g if i have file linuxFirst.java then i want to rename it to linuxFirst_bu.java ..Then want replace with latest... (1 Reply)
Discussion started by: maheshkaranjkar
1 Replies

6. Shell Programming and Scripting

Duplicate name diff file ext

Hi All I have converted a load of files to different formats but I am now left with a folder with loads of differnt files All of them are called the same, the only differnce is the file extension (Sizes also vary so cannot do anything with MD5) example file1.abc file1.xyz file2.abc... (2 Replies)
Discussion started by: tofa83
2 Replies

7. Shell Programming and Scripting

Script to monitor for new file with ext .err and size > 0 bytes and perform a action or command

Hi All, I need to create a script to monitor a dir for new files with ext .err and also it should b a non empty files. and perform a action or command . We have a new ETL application that runs on a linux server, every times a etl fails it creates a .err file or updates the existing .err... (4 Replies)
Discussion started by: MAKHAN
4 Replies

8. Shell Programming and Scripting

ext File

I have a log file that I want to extract the field name and the field value and write them to a text file for importation it a database table for reporting purposes. How can I extract the desired data from this file . Example: dbt_dbid=4 dbt_dbid is the field name 4 is the field value... (4 Replies)
Discussion started by: JolietJake
4 Replies
Mojo::Log(3pm)						User Contributed Perl Documentation					    Mojo::Log(3pm)

NAME
Mojo::Log - Simple logger SYNOPSIS
use Mojo::Log; # Log to STDERR my $log = Mojo::Log->new; # Customize log file location and minimum log level my $log = Mojo::Log->new(path => '/var/log/mojo.log', level => 'warn'); # Log messages $log->debug("Why isn't this working?"); $log->info("FYI: it happened again"); $log->warn("This might be a problem"); $log->error("Garden variety error"); $log->fatal("Boom!"); DESCRIPTION
Mojo::Log is a simple logger for Mojo projects. EVENTS
Mojo::Log can emit the following events. "message" $log->on(message => sub { my ($log, $level, @messages) = @_; ... }); Emitted when a new message gets logged. $log->unsubscribe('message'); $log->on(message => sub { my ($log, $level, @messages) = @_; say "$level: ", @messages; }); ATTRIBUTES
Mojo::Log implements the following attributes. "handle" my $handle = $log->handle; $log = $log->handle(IO::Handle->new); Log file handle used by default "message" event, defaults to opening "path" or "STDERR". "level" my $level = $log->level; $log = $log->level('debug'); Active log level, defaults to the value of the "MOJO_LOG_LEVEL" environment variable or "debug". These levels are currently available: "debug" "info" "warn" "error" "fatal" "path" my $path = $log->path $log = $log->path('/var/log/mojo.log'); Log file path used by "handle". METHODS
Mojo::Log inherits all methods from Mojo::EventEmitter and implements the following new ones. "new" my $log = Mojo::Log->new; Construct a new Mojo::Log object and subscribe to "message" event with default logger. "debug" $log = $log->debug('You screwed up, but that is ok'); Log debug message. "error" $log = $log->error('You really screwed up this time'); Log error message. "fatal" $log = $log->fatal('Its over...'); Log fatal message. "format" my $message = $log->format('debug', 'Hi there!'); my $message = $log->format('debug', 'Hi', 'there!'); Format log message. "info" $log = $log->info('You are bad, but you prolly know already'); Log info message. "is_level" my $success = $log->is_level('debug'); Check log level. "is_debug" my $success = $log->is_debug; Check for debug log level. "is_error" my $success = $log->is_error; Check for error log level. "is_fatal" my $success = $log->is_fatal; Check for fatal log level. "is_info" my $success = $log->is_info; Check for info log level. "is_warn" my $success = $log->is_warn; Check for warn log level. "log" $log = $log->log(debug => 'This should work'); Emit "message" event. "warn" $log = $log->warn('Dont do that Dave...'); Log warn message. SEE ALSO
Mojolicious, Mojolicious::Guides, <http://mojolicio.us>. perl v5.14.2 2012-09-05 Mojo::Log(3pm)
All times are GMT -4. The time now is 03:05 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy