unix - How can I omit a specific comma from my output? -
i wanted format output using awk/sed, can't understand how it. using following command:
uptime | awk '{print $1" " $2" " $3$4" " $6" " $10$11$12}' 15:36:17 177days, 7 0.39,0.43,0.36
my desired output
15:36:17 177days 7 0.39,0.43,0.36
i wanted omit first comma, i.e. 1 after "177days".
use either sub
(substitute comma empty string) or substr
(make substring last character):
uptime | awk '{sub(",","",$4); print $1" " $2" " $3$4" " $6" " $10$11$12}' uptime | awk '{print $1" " $2" " $3 substr($4,1,length($4)-1) " " $6" " $10$11$12}'
Comments
Post a Comment