shell - Replacement of single space with sed without touching multiple spaces -
replacement of single space using sed without touching sequences of several spaces.
i have file looks this:
host/domain summary: message delivery sent cnt bytes defers avg dly max dly host/domain -------- ------- ------- ------- ------- ----------- 937 3293k 0 18.6 s 6.9 m theory.tifr.res.in 462 3740k 0 7.3 s 9.5 m ncra.tifr.res.in 286 1053k 4 20.4 s 1.3 h gmail.com question:
i want replace single space comma or without space without touching other spaces. have tried sed directly takes space , replaces them comma.
example: 18.6 s , 6.9 m having single space can replace value give in sed others cannot.
how can done?
it seems funny thing doing, should want do:
sed 's/\([^ ]\) \([^ ]\)/\1,\2/g' replace non-blank followed blank followed non-blank first non-blank, comma, , second non-blank. repeat each single blank in line.
Comments
Post a Comment