s命令前面是确定查找那些行。 问题中/,/是个正则表达式,表示只要该行中有逗号,那么就执行s命令。 如果你写成1,2s means only executing the s command on the first and second lines;
s命令后面是命令内容: /将要被替换的内容/替换成的内容/, 对应问题中 s/,/ /;
In summary, find the lines with commas and perform matching: if a comma is matched, replace the comma with a space. As for gp, I won’t explain too much, I believe you understand.
s
命令前面是确定查找那些行。问题中
/,/
是个正则表达式,表示只要该行中有逗号,那么就执行s命令。 如果你写成1,2s
means only executing the s command on the first and second lines;s
命令后面是命令内容:/将要被替换的内容/替换成的内容/
, 对应问题中s/,/ /
;In summary, find the lines with commas and perform matching: if a comma is matched, replace the comma with a space. As for
gp
, I won’t explain too much, I believe you understand.Match lines with , , and replace all , with spaces