Sponsored Content
Top Forums Shell Programming and Scripting Date format change in a csv file Post 302949001 by Smiling Dragon on Sunday 5th of July 2015 10:30:10 PM
Old 07-05-2015
Quote:
Originally Posted by Aia
Why? The GNU utilities are so ubiquity that chances are that it would work for the OP as well as for anyone searching how to do something similar. In fact, you have used the GNU date all this time, without knowing you could have been using another crippled version.
I think this is a fair question, although I risk taking us a long way off topic here Smilie

The thing to remember is that most Unix is still not Linux and that many Unixes that are not Linux do not implement GNU versions of the commands by default. One reason that I could suggest (I don't know for sure) is that not all Unix is free and therefor would clash with the GPL.

If you can solve something for every platform, then wonderful!
If you can solve something for most platforms, then that's still pretty good
If you have to solve something for a small number of platforms, then OK, but you should get to this conclusion as a last resort.
This User Gave Thanks to Smiling Dragon For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

script to change the date format in a file

i have many files with date format of 6-9-2008 and i want a script that can change the format to 2008-06-09 Thanks (15 Replies)
Discussion started by: shehzad_m
15 Replies

2. Shell Programming and Scripting

Format a date in a csv file

So I have a csv file where the 3rd field is a date string in the format yyyy-mm-dd. I need to change it to mm/dd/yyyy. So each line in the csv file looks like: StringData,StringData,2009-02-17,12.345,StringData StringData,StringData,2009-02-16,65.789,StringData Any idea how I can keep... (5 Replies)
Discussion started by: rpiller
5 Replies

3. Shell Programming and Scripting

How to change date format in file

Hello! I have a textfile that look like this: "83d1:46:2b";"20091008190000";"Rögle BK - Skellefteå";"Swedish" "d4c:46:21";"20091008190000";"Södertälje - Brynäs";"Swedish" "d4b:46:2";"20091008190000";"HV 71 - Färjestad";"Swedish" "838:46:b";"20091010160000";"Skellefteå - HV 71";"Swedish"... (2 Replies)
Discussion started by: condmaster
2 Replies

4. Shell Programming and Scripting

File date format how to change

Hi All, Below are the unix files taken by the help of ls -lrt -rw-r--r-- 1 kbehera Domain Users 293 Jul 27 13:33 sand.txt -rw-r--r-- 1 kbehera Domain Users 4 Jul 27 13:37 sand1.txt -rw-r--r-- 1 kbehera Domain Users 293 Jul 27 15:30 new_sand.txt -rw-r--r-- 1 kbehera Domain Users 0 Jul 27... (2 Replies)
Discussion started by: krupasindhu18
2 Replies

5. Shell Programming and Scripting

Changing date format in CSV file

I have a CSV file with a date format like this; 11/19/2012 17:37:00,1.372,121.6 11/19/2012 17:38:00,0.743,121.6 Want to change the time stamp to seconds after 1970 so I can get the data in rrdtool. For anyone interested, this is data from a TED5000 unit and is Kwatts and volts. Needs to... (3 Replies)
Discussion started by: ottsm
3 Replies

6. Shell Programming and Scripting

How to change the format of the date column in a flat file?

Hi, i have a flat file namely temp.txt with this data below ID|name|contact_date 101|Kay|2013-12-26 102|let|2013-12-26 I need to modify the date data in the flat file into MM/DD/YYYY HH24:MI:SS format let me know the code for this. Thank you! (5 Replies)
Discussion started by: srikanth_sagi
5 Replies

7. Shell Programming and Scripting

Datestamp format 2nd change in csv file (awk or sed)

I have a csv file formatted like this: 2014-08-21 18:06:26,A,B,12345,123,C,1232,26/08/14 18:07and I'm trying to change it to MM/DD/YYYY HH:MM for both occurances. I have got this: awk -F, 'NR <=1 {print;next}{"date +%d/%m/%Y\" \"%H:%m -d\""$1 "\""| getline dte;$1=dte}1' OFS="," test.csvThis... (6 Replies)
Discussion started by: say170
6 Replies

8. Shell Programming and Scripting

Need to change date format in a csv file using awk

Example: Input csv file 00245DLS,Sitel Ocala,12/31/2014,18:45,1.00,7.00,0.00,0.00 00245DLS,Sitel Ocala,12/31/2014,19:00,-1.00,-1.00,-1.00,-1.00 00245HB,Charlotte,01/01/2015,00:00,-1.00,-1.00,-1.00,0.00 Output csv file 00245DLS,Sitel Ocala,2014/12/31,18:45,1.00,7.00,0.00,0.00 00245DLS,Sitel... (8 Replies)
Discussion started by: adit
8 Replies

9. Shell Programming and Scripting

Change date format in am/pm in csv files using UNIX

Hi All, I'm new to forum good to hear all. I stuck in converting date format in csv file using unix csv file contains as below ,750,0000000000000000GCJR, ,06/22/2016 14:48:44 I want to convert into as below ,750,0000000000000000GCJR, ,06/22/2016 02:48:44 PM Please reply asap..... (22 Replies)
Discussion started by: Raghureds
22 Replies

10. UNIX for Beginners Questions & Answers

Change date format in a file.

Hi all, I have a file as below, i would like the change the format of the time from "11/7/2019 20:12" to "2019-07-11 20:12:00" in the last coloumn. any awk solution on this. Input: 2,0,695016,1961612,497212,5800804,0,0,161,33,7605,12226,23,10,66,0,0,34,11/7/2019 20:10... (4 Replies)
Discussion started by: Raghuram717
4 Replies
SHTOOL-PLATFORM.TMP(1)					      GNU Portable Shell Tool					    SHTOOL-PLATFORM.TMP(1)

NAME
shtool-platform - GNU shtool Unix platform identification SYNOPSIS
shtool platform [-F|--format format] [-S|--sep string] [-C|--conc string] [-L|--lower] [-U|--upper] [-v|--verbose] [-c|--concise] [-n|--newline] [-d|--debug] [-t|--type type] [-n|--newline] [-d|--debug] DESCRIPTION
shtool platform is a flexible Unix platform identification program. It distinguishes a platform according to its hardware architecture and operating system. For both there is a class, product and technology identification. For each of those six identifications, there is a verbose, regular and concise version. This leads to eighteen (2x3x3) available identification strings for each platform, from which usually 2 are chosen in a particular situation. This is done by assembling the platform identification string using a format string containing one or more identification constructs of the forms ""%[xx]"" (verbose), ""%{xx}"" (regular) and ""%<xx>"" (concise). OPTIONS
The following command line options are available. -F, --format format This option controls the output formatting of this program. It is a plain-text string with the ""%"xx" constructs which expand to the various platform information strings. ""%{"xx"}"" is the canonical regular version of the information. ""%["xx"]"" is the verbose version of the information. ""%<"xx">"" is the concise version of the information. In total, the following constructs are available for expansion: %[ac] verbose hardware architecture class %{ac} regular hardware architecture class %<ac> concise hardware architecture class %[ap] verbose hardware architecture product %{ap} regular hardware architecture product %<ap> concise hardware architecture product %[at] verbose hardware architecture technology %{at} regular hardware architecture technology %<at> concise hardware architecture technology %[sc] verbose operating system class %{sc} regular operating system class %<sc> concise operating system class %[sp] verbose operating system product %{sp} regular operating system product %<sp> concise operating system product %[st] verbose operating system technology %{st} regular operating system technology %<st> concise operating system technology The default format string is ""%{sp} (%{ap})"", providing the regular operating system and hardware architecture product information. -S, --sep string This option sets the word separation string for the platform information strings. By default it is "" "" (whitespace). It is especially used for separating the operating system name and the operating system version. -C, --conc string This option sets the word concatenation string for the platform information strings. By default it is ""/"". It is especially used to concatenate multiple parts in operating system name and version parts. -L, --lower This options enforces conversion of the output to all lower case. -U, --upper This options enforces conversion of the output to all upper case. -v, --verbose This option enforces verbose versions of all expansion constructs in format string of option -F. It is equal to specifying all expansion constructs as ""%["xx"]"". -c, --concise This option enforces concise versions of all expansion constructs in format string of option -F. It is equal to specifying all expansion constructs as ""%<"xx">"". -n, --no-newline This option omits the usual trailing newline character in the output. -t, --type type This option is a meta option which internally sets options -F, -S, -C, -L, -U, -v or -c according to TYPE. It can be used to easily specify various commonly known outputs. The following TYPEs are available: binary Binary Package Id (OpenPKG RPM). This is equal to ""-F '%<ap"-%<sp>' -L -S '' -C '+'>" and results in outputs like ""ix86-freebsd4.9"" and ""ix86-debian3.0"". build Build-Time Checking (OpenPKG RPM). This is equal to ""-F '%<at"-%<st>' -L -S '' -C '+'>" and results in outputs like ""i686-freebsd4.9"" and ""i586-linux2.4"". gnu GNU config.guess Style Id. This is similar to build and is equal to ""-F '"%<at"-unknown-%<st>' -L -S '' -C '+'>" and results in outputs like ""i686-unknown-freebsd4.9"" and ""i586-unknown-linux2.4"". web HTTP Server Header Id. This is equal to ""-F '"%<sp"-%<ac>' -S '/' -C '+'>" and results in outputs like ""FreeBSD/4.9-iX86"" and ""Debian/3.0-iX86"". summary Human Readable Verbose Summary Information. This is equal to ""-F 'Class: %[sc] (%[ac]) Product: %[sp] (%[ap]) Technology: %[st] (%[at])' -S ' ' -C '/'"" and results in outputs like: Class: 4.4BSD (iX86) Product: FreeBSD 4.9-RC (iX86) Technology: FreeBSD 4.9-RC (i686) and Class: LSB (iX86) Product: Debian GNU/Linux 3.0 (iX86) Technology: GNU/Linux 2.2/2.4 (i686) all-in-one All-In-One Full-Table Information. This just outputs really all 2x2x3 identification strings as a table. -d, --debug This option enables some internal debugging messages. -V, --version This option outputs the version information of shtool platform only. -h, --help This option outputs the usage information of shtool platform only. EXAMPLE
The following real-life use cases are known: OpenPKG build-time decisions $ platform -c -L -S "" -C "+" -F "%at-%st" $ platform -c -L -S "" -C "+" -F "%ac-%sc" OpenPKG binary RPM packages $ platform -c -L -S "" -C "+" -F "%ap-%sp" README files $ platform -v -F "%sp (%ap)" $ platform -v -F "%sc (%ac)" Debugging $ platform --type=all-in-one SUPPORT
shtool platform currently knows the following particular Unix platforms in detail: FreeBSD, NetBSD, OpenBSD, Linux, Sun Solaris, SCO UnixWare, QNX Neutrino, SGI IRIX, HP HP-UX, HP Tru64, IBM AIX and Apple Mac OS X Darwin. All other Unix platforms are recognized through generic uname(1) information and so usually can be identified sufficiently, although the identification might be not as precise as possible. HISTORY
shtool platform was implemented in September 2003 by Ralf S. Engelschall for use in the OSSP and OpenPKG projects. It was prompted by the need in OpenPKG to have both product (for RPM filenames) and technology (for build-time decisions) identifiers for the Unix platforms, OpenPKG packages are maintained for. It was inspired by the GNU config.guess and the old GNU shtool guessos command. The major difference to GNU config.guess is that shtool platform does not use a vendor identification (cannot be determined most of the time and is not used at all in all projects I've ever seen) and is a lot more flexible (class, product and technology identifications combined with verbose, regular and concise outputs). The drawback of shtool platform is that it (still) knows less particular platforms, although the generic platform identification is sufficient enough most of the time. SEE ALSO
uname(3), GNU config.guess. 18-Jul-2008 shtool 2.0.8 SHTOOL-PLATFORM.TMP(1)
All times are GMT -4. The time now is 02:29 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy