Sponsored Content
Top Forums Shell Programming and Scripting rename file to file.ext.datetime Post 302136932 by tripsat on Thursday 20th of September 2007 02:13:41 PM
Old 09-20-2007
rename file to file.ext.datetime

Hi,

I need to rename a file like this to include date and time:

Original File : error.log

Date time: Sep 20, 2007 14:10:10
New File Name: error.log.20070920_1410

How can I get date and time stame and include it in mv command.

Thanks in advance
 

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
ncab2clf(1)							   User Commands						       ncab2clf(1)

NAME
ncab2clf - convert binary log file to Common Log File format SYNOPSIS
/usr/bin/ncab2clf [-Dhv] [-i input-file] [-o output-file] [-b size] [-n number] [-s datetime] DESCRIPTION
The ncab2clf command is used to convert the log file generated by the Solaris Network Cache and Accelerator ("NCA") from binary format, to Common Log File ("CLF") format. If no input-file is specified, ncab2clf uses stdin. If no output-file is specified, the output goes to std- out. OPTIONS
-b Specifies the binary-log-file blocking in kilobytes; the default is 64 Kbyte. -D Specifies that direct I/O be disabled. -h Prints usage message. -i input-file Specifies the input file. -n number Output number CLF records. -o output-file Specifies the output file. -s datetime Skip any records before the date and time specified in datetime. You can specify the date and time in CLF format or in the format specified by the touch(1) utility. CLF format is the dominant format, so ncab2clf first analyzes datetime assuming CLF. -v Provides verbose output. EXAMPLES
Example 1 Converting a Binary File to a Common Log File Format The following example converts the binary file /var/nca/logs/nca.blf to a file /var/nca/logs/nca.clf, which is in Common Log File format. example% ncab2clf -D -i /var/nca/logs/nca.blf -o /var/nca/logs/nca.clf Example 2 Converting Multiple Log Files The following script may be used to convert multiple log files. The directory designated by "*" must only contain log files. !/bin/ksh for filename in * do ncab2clf -D < $filename > $filename.clf done Example 3 Using -s and -n on a Raw Device The following example shows how ncab2clf can be used on a raw device. If not using the -n option, the default is to convert all records from the starting location to the end of the file. The date and time specified with -s, below, is in CLF format. example% ncab2clf -s '10/Apr/2001:09:23:13' -n 100 < /dev/dsk/c2t1d0s6 EXIT STATUS
The following exit values are returned: 0 The file converted successfully >0 An error occurred. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWncau | +-----------------------------+-----------------------------+ |Interface Stability |Evolving | +-----------------------------+-----------------------------+ SEE ALSO
nca(1), ncakmod(1), nca.if(4), ncakmod.conf(4), ncalogd.conf(4), attributes(5) System Administration Guide: IP Services NOTES
The binary log files generated by NCA can become very large. When converting these large binary files, use the -b option to the ncab2clf command to help performance. Direct I/O is a benefit to the user if the data being written does not come in as large chunks. However, if the user wishes to convert the log file in large chunks using the -b option, then direct I/O should be disabled by using the -D option. SunOS 5.11 28 Sep 2001 ncab2clf(1)
All times are GMT -4. The time now is 07:21 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy