Quantcast
Channel: UNIX and Linux Forums
Viewing all articles
Browse latest Browse all 16232

sed add space X times

$
0
0
Pattern:
Mary walks at the park every day with her children


Code:

sed 's/$/ /'
will make it add 1 space at the end (trailing)

I want to add X ($VARIABLE) number of spaces (which comes from RANDOM)

i.e.
VARIABLE='14'
then it will do:
Code:

sed 's/$/              /'
= 14 spaces added at the end.....

Some suggestions how to do that?

I tried to do it adding unicode xA0 but it didn't work

Thanks!

Viewing all articles
Browse latest Browse all 16232

Trending Articles