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
LIBEXSLT(3)						     Library Functions Manual						       LIBEXSLT(3)

NAME
libexslt - extension library for XSLT SYNOPSIS
#include <libexslt/exslt.h> void exsltCommonRegister(void); void exsltDateRegister(void); void exsltDynRegister(void); void exsltFuncRegister(void); void exsltMathRegister(void); void exsltSetsRegister(void); void exsltStrRegister(void); void exsltRegisterAll(void); void exsltSaxonRegister(void); DESCRIPTION
The libexslt library is used to provide extensions to XSLT functions. These extensions come from the EXSLT project <http://www.exslt.org/> USAGE
To make use of these functions in XSLT the appropriate namespace must be defined on the xsl:stylesheet element. To enable support for them in libxslt(3) you must call the appropriate functions (listed in the SYNOPSIS section) to register the extensions. The xslt-config shell script can be used to obtain the necessary flags for the pre-processor and linker. The supported extensions are: COMMON Namespace: http://exslt.org/common See http://www.exslt.org/exsl/index.html for a description. node-set() convert the given RTF into a node-set. object-type() returns the type of the given argument. document Create multiple output documents. See http://www.exslt.org/exsl/elements/document/index.html MATH Namespace: http://exslt.org/math See http://www.exslt.org/math/index.html for a description. min() returns the minimum value of the given node-set max() returns the maximum value of the given node-set highest() returns the nodes in the node-set whose value is the maximum value for the node-set. lowest() returns the nodes in the node-set whose value is the minimum value for the node-set. constant() returns a number value of the given constant with the given precision. The constants are PI, E, SQRRT2, LN2, LN10, LOG2E, and SQRT1_2. random() returns a random number between 0 and 1 inclusive. abs() returns the absolute value of the argument. sqrt() returns the square root of the argument. power() returns the power base and power arguments. log() returns the natural log of the argument. sin() returns the sine of the argument. cos() returns the cosine of the argument. tan() returns the tangent of the argument. asin() returns the arc sine of the argument. acos() returns the arc cosine of the argument. atan() returns the arc tangent of the argument. atan2() returns the arc tangent function of the y/x arguments. exp() returns the exponential function of the argument. SETS Namespace: http://exslt.org/sets See http://www.exslt.org/set/index.html for a description. difference() returns the difference between the two given node-sets. intersection() returns a node-set of the nodes within both given node-sets. distinct() returns a node-set of all nodes in the first argument that are not in the seconds argument. has-same-node() returns TRUE if there is an intersection between the two given node-sets. leading() returns a node-set of all nodes in the first argument that precede the first node in the second argument. trailing() returns a node-set of all nodes in the first argument that follow the first node in the second argument. DATES and TIMES Namespace: http://exslt.org/dates-and-times See http://www.exslt.org/date/date.html for a description. date-time() returns the current date and time as a date/time string. date() returns the date specified in the given date/time string. time() returns the time specified in the date/time string given as the argument. year() returns the year of a date as a number. leap-year() returns true if the year given in a date is a leap year. month-in-year() returns the month of a date as a number. month-name() returns the full name of the month of a date. month-abbreviation() returns the abbreviation of the month of a date. week-in-year() returns the week of the year as a number. week-in-month() returns the week in a month of a date as a number. day-in-year() returns the month of a date as a number. day-in-month() returns the day of a date as a number. day-of-week-in-month() returns the day-of-the-week in a month of a date as a number. day-in-week() returns the day of the week given in a date as a number. day-name() returns the full name of the day of the week of a date. day-abbreviation() returns the abbreviation of the day of the week of a date. hour-in-day() returns the hour of the day as a number. minute-in-hour() returns the minute of the hour as a number. second-in-minute() returns the second of the minute as a number. seconds() returns the number of seconds specified by the argument string. add() returns the date/time resulting from adding a duration to a date/time. add-duration() returns the duration resulting from adding two given durations together. difference() returns the duration between the first date and the second date. duration() returns a duration string that represents the given number of seconds since 1970-01-01T00:00:00. STRINGS Namespace: http://exslt.org/strings See http://www.exslt.org/str/index.html for a description. tokenize() returns a node set of token elements, each containing one token from the string. padding() returns a string padded to a certain length. align() returns a string aligned within another string. concat() returns the concatenation of the string values of the nodes in that node set. FUNCTIONS Namespace: http://exslt.org/functions See http://www.exslt.org/func/index.html for a description. function declares an extension function. result returns the result of an extension function declared in function(). FILES
/usr/bin/xslt-config shell script giving pre-processor and linker flags. /usr/lib/libexslt.a static library /usr/lib/libexslt.so sharable library AUTHORS
Manual page by Heiko W. Rupp (hwr@pilhuhn.de) SEE ALSO
libxml(3), libxslt(3), xmllint(1) xsltproc(1), libxslt 04 November 2003 LIBEXSLT(3)
All times are GMT -4. The time now is 01:27 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy