(Video materials in preparation)
dayslash : Transformation of date / time format
Usage : dayslash <f1> <f2>... <file>
dayslash -d <string>
Options : --input <format>
--output <format>
--through <string>
Version : Tue Jan 9 09:02:34 JST 2024
Edition : 2
In --output <format>, you can designate as below (Example)
yyyy : year (2013)
mm : month (09)
m : month (9)
mmm : month (Sep)
dd : day (04)
d : day (4)
HH : hour (08)
H : hour (8)
MM : minute(09)
M : minute(9)
SS : second(05)
S : second(5)
sss : milisecond(012)
s : milisecond(12)
For exmaple,
'HH:MM_dd/mm/yyyy' -> 15:14_03/12/2014
'd(mmm)yyyy' -> 4(9)1966
'mmmdd/yyyy' -> Sep04/2013
Input format is designated in --input <format> and <f> is a target
field of input for transformation. Output format is designated in
--output <format>
If you do not designame input format, 'yyyymmddHHMMSSsss' or
'yyyymmddHHMMSS' or 'yyyymmdd' or 'HHMMSS' format is assumed as
input format. Input format is distinguished according to number of
digit as below.
yyyymmddHHMMSSsss -- 17 digits
yyyymmddHHMMSS -- 14 digits
yyyymmdd -- 8 digits
HHMMSS -- 6 digits
For example,
--output 'HH:MM_dd/mm/yyyy'
assumes input format like 201412031514
--output 'd/(m)yyyy&
assumes input format like 19660904
"-d" option means direct mode. directly designated argument is
transformed.
$ echo 20120304 | dayslash --output yyyy/mm/dd 1
2012/03/04
$ echo 20120304 20130118 | dayslash --output yyyy/mm/dd 1 2
2012/03/04 2013/01/18
$ dayslash -d --output yyyy/mm/dd 20120304
2012/03/04
$ echo 050607 | dayslash --output H:M:S 1
5:6:7
$ echo 20111201235958 | dayslash --output m/d 1
12/1
$ echo - | dayslash --through - --output yyyy/mm/dd 1
-
$ echo 20111201235958002 | dayslash --output yyyy/mm/dd_HH:MM:SS.sss 1
2011/12/01_23:59:58.002
$ echo 20111201235958002 | dayslash --output yyyy/mm/dd_HH:MM:SS.s 1
2011/12/01_23:59:58.2
Data consistency of input is not checked.
"dayslash" command sees only number of digit of input data.
From argument of --input <format>, data is analyzed and
output to yyyymmddHHMMSSsss or yyyymmddHHMMSS or
yyyymmdd or HHMMSS in this order.
If you designate --output <format>, output format follows
the desinated format.
In --input <format>, '.' means anonymous 1 character.
$ echo 2012/03/04 | dayslash --input yyyy/mm/dd 1
20120304
$ echo 5:6:7 | dayslash --input H:M:S 1
050607
$ echo 2011/12/1_23:59:10 | dayslash --input yyyy/m/d_HH:MM:SS 1
20111201235910
$ echo 2011/12/1_23:59:10.0 | dayslash --input yyyy/m/d_HH:MM:SS.s 1
20111201235910000
$ echo '13/4(Thu)/2012' | dayslash --input 'd/m(...)/yyyy' 1
20120413
$ echo Apr13/2013 | dayslash --input 'mmmdd/yyyy' 1
20130413
Data consistency as date and time is not checked. Unmatched input
format causes an error.
If you designate --through <string> option, <string> does not cause
an error and output as it is.
$ echo - | dayslash --through - --input yyyy/mm/dd_HH:MM:SS 1
-
The old fashioned syntax is also accepted.
dayslash yyyy/mm/dd 1 same as --output yyyy/mm/dd
dayslash -r yyyy/mm/dd 1 same as --input yyyy/mm/dd