Sponsored Content
Top Forums Shell Programming and Scripting Keeping padding in a date field Post 302275167 by radoulov on Friday 9th of January 2009 12:17:42 PM
Old 01-09-2009
Just quote the identifier:

Code:
bash-3.2.48(21)[~]$ CURRENT_DATE="$(date +"%a %b %e")"
bash-3.2.48(21)[~]$ echo $CURRENT_DATE 
Fri Jan 9
bash-3.2.48(21)[~]$ echo "$CURRENT_DATE"
Fri Jan  9

 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Arrange date in a field

Hi all, If I have a flat file ID|Location|Date|Hostname|Age|Sex 1|SFO|06/02/24 12:12:34|hawkeye|35|M 2|LAX|06/02/24 13:12:35|sf49ers|30|M 3|OAK|06/02/25 11:12:36|goraiders|27|F 4|PIT|06/02/25 12:12:37|steeler|35|M How can I create an output 1|SFO|02/24/2006 12:12:34|hawkeye|35|M... (6 Replies)
Discussion started by: sabercats
6 Replies

2. Shell Programming and Scripting

handling date field

Hi, Is there any way we could change the date format listed below... date I get is 03302007 (MMDDYYYY) I need to change it to 20070330 (YYYYMMDD) Thanks. (3 Replies)
Discussion started by: mgirinath
3 Replies

3. Shell Programming and Scripting

CSV formatting with prefixing, appending and padding field

Hi I have a very large csv file with some hundreds of thousands of rows of data. The data is in the following format: Up to four alpha numeric characters for the first word. This is either set as 2 characters followed by 2 spaces, or as a single 4character word. This is then followed by an 8... (7 Replies)
Discussion started by: meself
7 Replies

4. Shell Programming and Scripting

date field manipulation

I have a data file. Seperated by "|". The 19 th filed is a date field that occurs like this 11/02/2001 i need to convert into the below format 2001-11-02 for e.g.. i/p o/p should be can somebody throw some light (5 Replies)
Discussion started by: dsravan
5 Replies

5. UNIX for Advanced & Expert Users

change field 2 date format

from this input WEBELSOLAR,29122009,1:1 WIPRO,15062010,2:3 ZANDUREALT,18012007,1:3 i want output as WEBELSOLAR,20091229,1:1 WIPRO,20100615,2:3 ZANDUREALT,20070118,1:3 basically input is in ddmmyyyy format and i was to convert it to yyyymmdd format (1 Reply)
Discussion started by: manishma71
1 Replies

6. Shell Programming and Scripting

Replace date value with another value keeping all as is

Hi forum. How do I change the following date value with another value (while keeping the rest of the line) using sed? The date values can change so I need a general sed command to change the date value within the first quotation marks only. Date values will be coming from 2 different files.... (2 Replies)
Discussion started by: pchang
2 Replies

7. Shell Programming and Scripting

Check if a date field has date or timestamp or date&timestamp

Hi, In a field, I should receive the date with time stamp in a particular field. But sometimes the vendor sends just the date or the timestamp or correctl the date&timestamp. I have to figure out the the data is a date or time stamp or date&timestamp. If it is date then append "<space>00:00:00"... (1 Reply)
Discussion started by: machomaddy
1 Replies

8. Shell Programming and Scripting

Sort, sed, and zero padding date column csv bash scripting

Hello people, I am having problem to sort, sed and zero padding of column in csv file. 7th column only. Input of csv file: 1,2,3,4,5,6,4/1/2010 12:00 AM,8 1,2,3,4,5,6,3/11/2010 9:39 AM,8 1,2,3,4,5,6,5/12/2011 3:43 PM,8 1,2,3,4,5,6,12/20/2009 7:23 PM,8 Output:... (5 Replies)
Discussion started by: sean1357
5 Replies

9. Linux

How do I format a Date field of a .CSV file with multiple commas in a string field?

I have a .CSV file (file.csv) whose data are all enclosed in double quotes. Sample format of the file is as below: column1,column2,column3,column4,column5,column6, column7, Column8, Column9, Column10 "12","B000QRIGJ4","4432","string with quotes, and with a comma, and colon: in... (3 Replies)
Discussion started by: dhruuv369
3 Replies
calendar(1)						      General Commands Manual						       calendar(1)

NAME
calendar - reminder service SYNOPSIS
DESCRIPTION
consults the file in the current directory and prints out lines containing today's or tomorrow's date anywhere in the line. On weekends, ``tomorrow'' extends through Monday. When a command-line argument is present, searches for the file in each user's home directory, and sends any positive results to the user by (see mail(1)). Normally this is done daily in the early morning hours under the control of (see cron(1M)). When invoked by reads the first line in the file to determine the user's environment. Language-dependent information such as spelling and date format (described below) are determined by the user-specified statement in the file. This statement should be of the form where language is a valid language name (see lang(5)). If this line is not in the file, the action described in the section is taken. is concerned with two fields: month and day. A month field can be expressed in three different formats: a string representing the name of the month (either fully spelled out or abbreviated), a numeric month, or an asterisk (representing any month). If the month is expressed as a string representing the name of the month, the first character can be either upper-case or lower-case; other characters must be lower- case. The spelling of a month name should match the string returned by calling (see nl_langinfo(3C)). The day field is a numeric value for the day of the month. Month-Day Formats If the month field is a string, it can be followed by zero or more blanks. If the month field is numeric, it must be followed by either a slash or a hyphen If the month field is an asterisk it must be followed by a slash The day field can be followed immediately by a blank or non-digit character. Day-Month Formats The day field is expressed as a numeral. What follows the day field is determined by the format of the month. If the month field is a string, the day field must be followed by zero or one dot followed by zero or more blanks. If the month field is a numeral, the day field must be followed by either a slash or a hyphen If the month field is an asterisk, the day field must be followed by a slash EXTERNAL INFLUENCES
Environment Variables determines the format and contents of date and time strings when no statement is specified in the file. determines the language in which messages are displayed. If is not specified in the environment or is set to the empty string, the value of is used as a default for each unspecified or empty vari- able. If is not specified or is set to the empty string, a default of "C" (see lang(5)) is used instead of If any internationalization variable contains an invalid setting, behaves as if all internationalization variables are set to "C". See environ(5). International Code Set Support Single- and multi-byte character code sets are supported. EXAMPLES
The following file illustrates several formats recognized by calendar: In the following file, dates are expressed according to European English usage: WARNINGS
To get reminder service, either your calendar must be public information or you must run from your personal file, independent of any run systemwide. Note that if you run yourself, the calendar file need not reside in your home directory. extended idea of ``tomorrow'' does not account for holidays. This command is likely to be withdrawn from X/Open standards. Applications using this command might not be portable to other vendors' platforms. AUTHOR
was developed by AT&T and HP. FILES
to figure out today's and tomorrow's dates SEE ALSO cron(1M), nl_langinfo(3C), mail(1), environ(5). STANDARDS CONFORMANCE
calendar(1)
All times are GMT -4. The time now is 11:14 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy