gpt4 book ai didi

linux - 转换 d.m.Y h :m:s to Y-d-m h:m:s for a large file in linux

转载 作者:太空宇宙 更新时间:2023-11-04 06:00:27 25 4
gpt4 key购买 nike

是否可以将 Linux 中的大文件将 d.m.Y h:m:s 转换为 Y-d-m h:m:s?

示例数据

"30.07.2016 00:00:00",DN123,PAPN,PAPN,TEST,918945,

想要转换为

"2016-07-30 00:00:00",DN123,PAPN,PAPN,TEST,918945,

最佳答案

假设您的文件名为 A.csv

使用以下内容:

awk -F","  '{print "\""substr($1,08,4)"-"substr($1,5,2)"-"substr($1,2,2)substr($1,12,9)"\","$2","$3","$4","$5","$6","}' A.csv > A.csv_new

然后您可以用旧文件替换新文件

mv A.csv_new A.csv

关于linux - 转换 d.m.Y h :m:s to Y-d-m h:m:s for a large file in linux,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41633336/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com