我有一个文本文件需要使用awk处理。
"5","1211274723","0","D","2"
"1","1211292921","0","A","2"
"5","1211295793","0","A","2"
"5","1211310146","0","A","2"
"5","1211310310","0","A","2"
"4","1211315271","0","A","2"
"5","1211318203","0","D","2"
"2","1211323658","0","A","2"
"5","1211329224","0","A","2"
"5","1211330064","0","A","2"
# cat testme.csv | awk -F',' '{print "set", $2, $3}'
set "1211274723" "0"
set "1211292921" "0"
set "1211295793" "0"
set "1211310146" "0"
set "1211310310" "0"
set "1211315271" "0"
set "1211318203" "0"
set "1211323658" "0"
set "1211329224" "0"
set "1211330064" "0"
字符串
唯一的问题是,我不知道如何删除电话号码周围的引号。所以我的最终输出看起来像这样…
set 1211274723 "0"
set 1211292921 "0"
set 1211295793 "0"
set 1211310146 "0"
set 1211310310 "0"
set 1211315271 "0"
set 1211318203 "0"
set 1211323658 "0"
set 1211329224 "0"
set 1211330064 "0"
型
2条答案
按热度按时间3phpmpom1#
你可以使用gsub函数:
字符串
de90aj5v2#
使用双引号作为字段分隔符;
字符串