Shell 通过管道传递参数到日期命令
通过读取文件将日期和时间传递给Shell 通过管道传递参数到日期命令,shell,unix,Shell,Unix,通过读取文件将日期和时间传递给date-d命令 我试过: #cat temp.txt 2013/10/31 10:57:02 #cat temp.txt | xargs date -d date: the argument `10:57:02' lacks a leading `+'; when using an option to specify date(s), any non-option argument must be a format string beginning with `+
date-d
命令
我试过:
#cat temp.txt
2013/10/31 10:57:02
#cat temp.txt | xargs date -d
date: the argument `10:57:02' lacks a leading `+';
when using an option to specify date(s), any non-option
argument must be a format string beginning with `+'
你可以说:
cat temp.txt | xargs -i date -d {}
或者避免,
date-d“$(你可以说:
cat temp.txt | xargs -i date -d {}
或者避免,
date-d“$(您也可以使用-0
$ cat temp.txt | xargs -0 date -d
当输入项可能包含空格、引号或
反斜杠
也可以使用-0
$ cat temp.txt | xargs -0 date -d
当输入项可能包含空格、引号或
反斜杠
如果使用时间戳,请使用此命令:cat temp.txt|xargs-i date-d@{}
如果使用时间戳,请使用此命令:cat temp.txt|xargs-i date-d@{}