sed on AIX is not doing what I think it should.I'm trying to replace multiple spaces with a single space in the output of IOSTAT:# iostatSystem configuration: lcpu=4 drives=8 paths=2 vdisks=0tty:      tin         tout    avg-cpu: % user % sys % idle % iowait          0.2         31.8                9.7   4.9   82.9      2.5Disks:        % tm_act     Kbps      tps    Kb_read   Kb_wrtnhdisk9           0.2      54.2       1.1   1073456960  436765896hdisk7           0.2      54.1       1.1   1070600212  435678280hdisk8           0.0       0.0       0.0          0         0hdisk6           0.0       0.0       0.0          0         0hdisk1           0.1       6.3       0.5   63344916  112429672hdisk0           0.1       5.0       0.2   40967838  98574444cd0              0.0       0.0       0.0          0         0hdiskpower1      0.2     108.3       2.3   2144057172  872444176# iostat | grep hdisk1hdisk1           0.1       6.3       0.5   63345700  112431123#iostat|grep hdisk1|sed -es/[ ]*/ /g h d i s k 1 0 . 1 6 . 3 0 . 5 6 3 3 4 5 8 8 0 1 1 2 4 3 2 3 5 4sed should search & replace (s) multiple spaces (/[ ]*/) with a single space (/ /) for the entire group (/g)... but it's not only doing that... its spacing each character.What am I doing wrong? I know its got to be something simple...AIX 5300-06edit: I have another computer that has 10+ hard drives. I'm using this as a parameter to another program for monitoring purposes.The problem I ran into was that awk '{print $5}' didn't work because I'm using $1, etc in the secondary stage and gave errors with the Print command. I was looking for a grep/sed/cut version. What seems to work is:iostat | grep hdisk1  | sed -e's/  */ /g' | cut -d  -f 5The []s were 0 or more when I thought they meant just one. Removing the brackets got it working. Three very good answers really quickly make it hard to choose the answer.
How to strip multiple spaces to one using sed?
text processing;sed;aix
The use of grep is redundant, sed can do the same. The problem is in the use of * that match also 0 spaces, you have to use \+ instead:iostat | sed -n '/hdisk1/s/ \+/ /gp'If your sed do not supports \+ metachar, then doiostat | sed -n '/hdisk1/s/  */ /gp'