Sponsored Content
Top Forums Shell Programming and Scripting How can i make my cron/script to generate a log filename with timestamp in it ? Post 302931665 by System Admin 77 on Wednesday 14th of January 2015 12:29:18 PM
Old 01-14-2015
@Corona688
Awesome. Thanks much for the prompt response. I really appreciate.
Initially i tried like below

/tmp/$"date +%m_%d_%y-%H.%M.%S".log

i was just doing trial and error. finally i got, what i was looking for in few seconds. that's great.


Thank you.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

how to add a timestamp to a filename?

whats going on guys. below is a script i made and am just curious if there is a "time stamp" command. so i can set the timestamp in a filename. #! /bin/ksh # # This scripts takes a list of files in the INDIR variable and compairs it to a list of files that are open in the same directory.... (2 Replies)
Discussion started by: Optimus_P
2 Replies

2. Shell Programming and Scripting

add timestamp to filename

Does anyone know how to add a timestamp to a file's name extension in a shell script? Please help.. (3 Replies)
Discussion started by: walterja
3 Replies

3. Shell Programming and Scripting

Modify script to generate a log file

I've seen several examples of scripts in thise forum about having a script generate a log file. I have a script that is run from cron and that monitors a file system for a specfic filename(s) and then performs some actions on them. Normally I call this script from another script (which the one... (2 Replies)
Discussion started by: heprox
2 Replies

4. Shell Programming and Scripting

Timestamp in the filename

Hi i want to replace the previous time stamp with the current timsatp at the start of the file like 20090710_113354_FT0710a.txt this one to 20091111__113354_FT0710a.txt thanks in advance (3 Replies)
Discussion started by: Reddy482
3 Replies

5. Shell Programming and Scripting

how to run script? call other script? su to another user? make a cron?

Good morning. I am searching for "how-to"'s for some particular questions: 1. How to write a script in HP-UX 11. 2. How to schedule a script. 3. How to "call" scripts from the original script. 4. How to su to another user from within a script. This is the basics of what the... (15 Replies)
Discussion started by: instant000
15 Replies

6. Programming

Generate a binary file using make

Hi, i am trying to create a makefile for my C++ program. when i say "make" it should generate the binary file. and when i say make clean, it should delete all the bins and libs. can u please help me out. (5 Replies)
Discussion started by: sunshine23
5 Replies

7. Shell Programming and Scripting

How to extract timestamp from the filename?

Hi., My file name is of the format: name_abc_20100531_142528.txt where., my timestamp is of the format: yyyymmdd_hhmmss How to extract the date strring and time string into seperate variables in the shell script, after reading the file as the input? I want to get the variables... (9 Replies)
Discussion started by: av_vinay
9 Replies

8. Shell Programming and Scripting

Get filename with size and timestamp

Hi, Below is a directory containing links new2,list,new1. I need to get the size and timestamp for them. How do i get these details. Please help lrwxrwxrwx 1 xxx abc 11 Nov 24 17:34 new2 -> ./org1/new2 lrwxrwxrwx 1 xxx abc 11 Nov 24 17:34 list -> ./org2/list lrwxrwxrwx 1 xxx abc 10... (2 Replies)
Discussion started by: pradebban
2 Replies

9. Shell Programming and Scripting

Filename timestamp

Hi Gurus, I have different files with different timestamp and different base file name, I have to group those files based on basename and provide a unique file name for similar file names. My Directory has following files. abc_filename_20130623:00:09:00.txt... (1 Reply)
Discussion started by: user_linux
1 Replies

10. Shell Programming and Scripting

How to sort the timestamp in the filename in shell script?

originally the shellscript #ln_file_name=`echo $ld_interface_date"_"${8}".csv"` #ln_file_name=`echo 201202011527_HL_HLTM1_B04A.csv` ln_file_name="*"`echo ${7}".csv"` get_file_list_1=$log_path"tm1_file_list.gfl1" cd ${source_path} echo "Try to find any file exist in the... (10 Replies)
Discussion started by: feilhk
10 Replies
ckdate(1)							   User Commands							 ckdate(1)

NAME
ckdate, errdate, helpdate, valdate - prompts for and validates a date SYNOPSIS
ckdate [-Q] [-W width] [-f format] [-d default] [-h help] [-e error] [-p prompt] [-k pid [-s signal]] /usr/sadm/bin/errdate [-W width] [-e error] [-f format] /usr/sadm/bin/helpdate [-W width] [-h help] [-f format] /usr/sadm/bin/valdate [-f format] input DESCRIPTION
The ckdate utility prompts a user and validates the response. It defines, among other things, a prompt message whose response should be a date, text for help and error messages, and a default value (which will be returned if the user responds with a RETURN). The user response must match the defined format for a date. All messages are limited in length to 70 characters and are formatted automatically. Any white space used in the definition (including new- line) is stripped. The -W option cancels the automatic formatting. When a tilde is placed at the beginning or end of a message definition, the default text will be inserted at that point, allowing both custom text and the default text to be displayed. If the prompt, help or error message is not defined, the default message (as defined under NOTES) will be displayed. Three visual tool modules are linked to the ckdate command. They are errdate (which formats and displays an error message), helpdate (which formats and displays a help message), and valdate (which validates a response). These modules should be used in conjunction with FML objects. In this instance, the FML object defines the prompt. When format is defined in the errdate and helpdate modules, the messages will describe the expected format. OPTIONS
The following options are supported: -d default Defines the default value as default. The default does not have to meet the format criteria. -e error Defines the error message as error. -f format Specifies the format against which the input will be verified. Possible formats and their definitions are: %b = abbreviated month name (jan, feb, mar) %B = full month name %d = day of month (01 - 31) %D = date as %m/%d/%y (the default format) %e = day of month (1 - 31; single digits are preceded by a blank) %h = abbreviated month name, identical to %b% %m = month number (01 - 12) %y = year within century (for instance, 89) %Y = year as CCYY (for instance, 1989) -h help Defines the help messages as help. -k pid Specifies that process ID pid is to be sent a signal if the user chooses to abort. -p prompt Defines the prompt message as prompt. -Q Specifies that quit will not be allowed as a valid response. -s signal Specifies that the process ID pid defined with the -k option is to be sent signal signal when quit is chosen. If no signal is specified, SIGTERM is used. -W width Specifies that prompt, help and error messages will be formatted to a line length of width. OPERANDS
The following operand is supported: input Input to be verified against format criteria. EXIT STATUS
The following exit values are returned: 0 Successful execution. 1 EOF on input, or negative width on -W option, or usage error. 3 User termination (quit). 4 Garbled format argument. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWcsu | +-----------------------------+-----------------------------+ SEE ALSO
attributes(5) NOTES
The default prompt for ckdate is: Enter the date [?,q]: The default error message is: ERROR - Please enter a date. Format is <format>. The default help message is: Please enter a date. Format is <format>. When the quit option is chosen (and allowed), q is returned along with the return code 3. The valdate module will not produce any output. It returns zero for success and non-zero for failure. SunOS 5.11 14 Sep 1992 ckdate(1)
All times are GMT -4. The time now is 10:42 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy