Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/regex/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Regex 使用awk、sed等命令从文件中删除字段_Regex_Awk_Sed_Grep - Fatal编程技术网

Regex 使用awk、sed等命令从文件中删除字段

Regex 使用awk、sed等命令从文件中删除字段,regex,awk,sed,grep,Regex,Awk,Sed,Grep,我需要使用awk从时间戳中删除时区部分 文件条目: 2015-09-30 07:01:33,979 test1 2015-09-30 07:01:33 test1 预期输出: 2015-09-30 07:01:33,979 test1 2015-09-30 07:01:33 test1 awk救援 $ echo "2015-09-30 07:01:33,979 test1" | awk -F"[ ,]" '{print $1,$2,$4}' 2015-09-30 07:01:33 te

我需要使用awk从时间戳中删除时区部分

文件条目:

2015-09-30 07:01:33,979 test1
2015-09-30 07:01:33 test1
预期输出:

2015-09-30 07:01:33,979 test1
2015-09-30 07:01:33 test1

awk
救援

$ echo "2015-09-30 07:01:33,979 test1" | awk -F"[ ,]" '{print $1,$2,$4}' 
2015-09-30 07:01:33 test1


不确定,为什么这个问题会被标记下来。因为你没有按照@dda的要求发布你已经尝试过的内容。注意当你的问题得到反对票时,他的评论得到了赞成票。如果你这样做了,你也会得到其他可能更好的答案。