Sponsored Content
Full Discussion: help in filename creation
Top Forums Shell Programming and Scripting help in filename creation Post 66723 by zazzybob on Wednesday 16th of March 2005 06:16:28 PM
Old 03-16-2005
Code:
touch todays_file.`date +%A`

man 3 strftime for other formatting modifiers....

Cheers
ZB
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

shortcut for tar cvf - [filename] | gzip > [filename].tar.gz

i'd like to have an alias (or something similar) where i can type a command like "archive" and a filename and have it tar and gzip the file, so... $ archive filename results in filename.tar.gz...do i have to write a script to do this? (4 Replies)
Discussion started by: bcamp1973
4 Replies

2. Shell Programming and Scripting

mv Filename variable to another filename

Anyone who can assist : I am trying to pass the group vairiable to a filename: rpt_tsavegrp=/export/legato/scripts/$group_savegrp_rpt.$dat It will not pass to variable. Anyone have any ideas what I am doing wrong here. Thanks # This script sends email that save group completed.... (3 Replies)
Discussion started by: gzs553
3 Replies

3. Shell Programming and Scripting

gzcat into awk and then change FILENAME and process new FILENAME

I am trying to write a script that prompts users for date and time, then process the gzip file into awk. During the ksh part of the script another file is created and needs to be processed with a different set of pattern matches then I need to combine the two in the end. I'm stuck at the part... (6 Replies)
Discussion started by: timj123
6 Replies

4. UNIX for Advanced & Expert Users

file creation

Hi, Is there any way to restrict directories with one type of file creation. regards. (8 Replies)
Discussion started by: guguli
8 Replies

5. Shell Programming and Scripting

rename multiple filename.45267.txt to >> filename.txt

i have several thousand files and in subdirs that are named file.46634.txt budget.75346.pdf etc i want to remove the number but retain the extension. it is always a 5 digit. thanks. (6 Replies)
Discussion started by: jason7
6 Replies

6. Shell Programming and Scripting

Filename from splitting files to have the same filename of the original file with counter value

Hi all, I have a list of xml file. I need to split the files to a different files when see the <ko> tag. The list of filename are B20090908.1100-20090908.1200_CDMA=1,NO=2,SITE=3.xml B20090908.1200-20090908.1300_CDMA=1,NO=2,SITE=3.xml B20090908.1300-20090908.1400_CDMA=1,NO=2,SITE=3.xml ... (3 Replies)
Discussion started by: natalie23
3 Replies

7. UNIX for Dummies Questions & Answers

"tail -n 1 filename" error while "head -n 1 filename" is ok?

Hi all, I was wondering why tail -n 2 filename produce an error when I manage to do similar command on head -n 2 filename SunOS{type8code0}: tail -n 2 filename usage: tail ] tail ] (2 Replies)
Discussion started by: type8code0
2 Replies

8. Shell Programming and Scripting

difference between sh filename.sh and . filename

Hi, Gurus, I feel sorry to ask this easy question, but to be honest, I really don't know. I have a question about execute shell script. I have script named as filename.sh with -rwxr-xr-x permission. when I execute it with . filename.sh It works properly. when I exec it with sh... (7 Replies)
Discussion started by: ken002
7 Replies

9. UNIX for Dummies Questions & Answers

to extract all the part of the filename before a particular word in the filename

Hi All, Thanks in Advance I am working on a shell script. I need some assistance. My Requirement: 1) There are some set of files in a directory like given below OTP_UFSC_20120530000000_acc.csv OTP_UFSC_20120530000000_faf.csv OTP_UFSC_20120530000000_prom.csv... (0 Replies)
Discussion started by: aealexanderraj
0 Replies

10. Programming

to extract all the part of the filename before a particular word in the filename

Hi All, Thanks in Advance I am working on a shell script. I need some assistance. My code: if then set "subscriber" "promplan" "mapping" "dedicatedaccount" "faflistSub" "faflistAcc" "accumulator"\ "pam_account"; for i in 1 2 3 4 5 6 7 8;... (0 Replies)
Discussion started by: aealexanderraj
0 Replies
strftime(3)						     Library Functions Manual						       strftime(3)

Name
       strftime - convert time and date to string

Syntax
       #include <time.h>

       int strftime (s, maxsize, format, tm)
       char *s;
       size_t maxsize;
       char *format;
       struct tm *tm;

Description
       The  function  places characters in the array pointed to by s.  No more than maxsize characters are placed into the array.  The string con-
       trols this process.  This string consists of zero or more directives and ordinary characters.  A directive consists of a character followed
       by  a  character that determines the behavior of the directive.	All ordinary characters are copied unchanged into the array, including the
       terminating null character.

       Each directive is replaced by the appropriate characters as shown in the following table. The characters are determined	by  the  program's
       locale category and the values contained in the structure pointed to by tm.

       -------------------------------------------------------------
       Directive   Replaced by
       -------------------------------------------------------------
       %a	   Locale's abbreviated weekday name
       %A	   Locale's full weekday name
       %b	   Locale's abbreviated month name
       %B	   Locale's full month name
       %c	   Locale's date and time representation
       %d	   Day of month as a decimal number (01-31)
       %D	   Date (%m/%d/%y)
       %h	   Locale's abbreviated month name
       %H	   Hour as a decimal number (00-23)
       %I	   Hour as a decimal number (01-12)
       %j	   Day of year (001-366)
       %m	   Number of month (01-12)
       %M	   Minute number (00-59)
       %n	   Newline character
       %p	   Locale's equivalent to AM or PM
       %r	   Time in AM/PM notation
       %S	   Second number (00-59)
       %t	   Tab character
       %T	   Time (%H/%M/%S)
       %U	   Week number (00-53), Sunday as first day of week
       %w	   Weekday number (0[Sunday]-6)
       %W	   Week number (00-53), Monday as first day of week
       %x	   Locale's date representation
       %X	   Locale's time representation
       %y	   Year without century (00-99)
       %Y	   Year with century
       %Z	   Timezone name, no characters if no timezone
       %%	   %
       -------------------------------------------------------------

       If a directive is used that is not contained in the table, the results are undefined.

   International Environment
       LC_TIME	      Contains the user's requirements for language, territory, and codeset for the time format.  affects the behavior of the time
		      functions in If is not defined in the current environment, provides the necessary default.

       LANG	      If this environment is set and valid, uses the international language database named in the definition to determine the time
		      formatting rules. If is defined, its definition supercedes the definition of

Return Values
       If  the	total  number  of  resulting characters, including the terminal null character, is not more than maxsize, the function returns the
       total of resultant characters placed into the array pointed to by s, not including the terminating null character.  In all other cases zero
       is returned and the contents of the array are indeterminate.

       As the name is not contained in the tm structure the value returned by %Z is determined by the function, see

See Also
       ctime(3), setlocale(3)

																       strftime(3)
All times are GMT -4. The time now is 05:44 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy