trying to add a date stamp to the name of a file with sed. can't seem to comment out the date command so that sed does not only see it as a literal text string
this is what I'm trying
but it's giving this
looking for something like
any ideas would be appreciated
For standard shells, command substitutions are not performed inside single-quoted strings. And, if they were, the sed substitute command you're using would produce output similar to:
not:
Why are you performing a global substitution when there can never be more than one match?
What are you trying to accomplish? Using ls and sed won't rename a file. If you want to rename files, there are much more efficient ways of coming up with the new names without invoking external utilities (other than date and mv).
If you're not trying to rename files, what is the purpose of this exercise?
Hello, can someone please suggest how to create an logrotate for this scenario. Need to delete all log file which are created more than 30 days ago, and all the log file have date stamp on it.
I dont want to create a cron job for this task.
here is the example
-rw-r--r-- 1 tomcat tomcat ... (2 Replies)
I have the awk
awk -F\* '$1=="ST",$1=="SE"{if($1=="ST"){close(f);f="sample" ++i} ; $1=$1; print>f}' OFS=\| <filename>
How to add the time stamp to the file name mentioned as "sample"
Please view this code tag video for how to use code tags when posting code and data. (6 Replies)
Hi
I use "touch -t xxxxxxxx" command to set date/time stamp of a file. My requirement is to read the date/time stamp of a file and apply it to another file.
Is there anyway to do it simple instead of manually taking date/stamp of first file?
TIA
Prvn (2 Replies)
Hi
When i do ls -ltr <file1> then it shows me the date and time of the file
if - for whatever reason file has future date/time stamp then ls -ltr is not showing the time, it just shows only date part ... even if time is ahead by 2 hr than current time.
suppose a file was copied from INDIA... (3 Replies)
I need to alter a file.
I'm using sed then passing output to temp file
then using touch -r to maintain the date but the permissions do not get preserved
How can I sed a file and maintain date and permissions
currently
it's preserving the date but the permissions revert back to the... (3 Replies)
Hi,
I am using the below copy command, to copy the file sbn to sbn1,
cp sbn sbn1
but its changing the date stamp of file sbn1, but i dont want to change the date stamp of sbn1.
Could you please help me out in this. (3 Replies)
Dear Gurus,
I'm trying to move a number of files from one directory to another directory with a new date stamp. This is my script:
#! /bin/csh
Today_Date=`date +%Y%M%D`
mv /usr/TRS/data/TS* /usr/TRS/backup/TS*.${Today_Date}
when i run the script i'm getting the following errors:
mv:... (14 Replies)
Hi,
can any one tell me how to achieve this...I will input the path and file name and it should rename it to current date and time...
this is what I tried...
#! /usr/bin/sh
set -x
cd /info_stg/vul/Scripts
TODAY_DATE_TIME=`date +%Y%m%d%H%M%S`
IN_FILE_PATH=`cat file.txt | awk -F, '{... (2 Replies)
I have to capture the creation date and time stamp for a file. The ls command doesn't list all the required information. I need year, month, day, hour, minute and second.
Any ideas... (1 Reply)