我需要在每個逗號之間的每個字符串之後每插入一個小數點。在逗號之間每隔一個數字之後在字符串中插入小數點
some.file:
JAN,334,333,332,331,330,330,329,328,328,327,327,327
嘗試代碼:
sed -i 's/\B[0-9]\{1\}\>/.&/' some.file
電流輸出:
JAN,33.4,333,332,331,330,330,329,328,328,327,327,327
預期輸出:
JAN,33.4,33.3,33.2,33.1,33.0,33.0,32.9,32.8,32.8,32.7,32.7,32.7
我試圖代碼似乎只抓取(看到)該數字串的第二個逗號,在該行不是每個數字串前述不管逗號,。
你只錯過了'g'標誌全部替換,而不只是第一個 – Sundeep