文字看起来像这样:
816 Organizational Relationships
832 Price/Sales Catalog
846 Inventory Inquiry/Advice
850 Purchase Order
855 Purchase Order Acknowledgment
我需要用,
谢谢
答案 0 :(得分:0)
用逗号替换任何第一个类似空格的字符(例如制表符或空格)(如果您确实需要冒号,请将,
替换为:
:
/\s/,/
(注意缺少g
标志)
示例Bash运行:
$> echo '816 Organizational Relationships
> 832 Price/Sales Catalog
> 846 Inventory Inquiry/Advice
> 850 Purchase Order
> 855 Purchase Order Acknowledgment' | sed -e 's/\s/,/'
816,Organizational Relationships
832,Price/Sales Catalog
846,Inventory Inquiry/Advice
850,Purchase Order
855,Purchase Order Acknowledgment
$>