How can we delete all the blank spaces in the beginning of some lines in a text in vi?
Thanks,
How can we delete all the blank spaces in the beginning of some lines in a text in vi?
Thanks,
To delete blank spaces at the start of lines 7 thru 21:
:7,21s/^ +//
That's [colon seven comma two one s slash carot space plus slash slash]
To do it on every line:
:%s/^ +//
That's [colon percent s slash carot space plus slash slash]
Colon = command mode
numbers or % = lines to edit
s = substitute
slashes separate pattern and replacement strings
carot = start of line
space = actual space
plus = one or more
2 slashes = empty replacement string = delete
hth,
dv
I tried it .It didn't work the first time with the following error: Pattern not foun ^ +. I simply escaped the + sign :
%s/^ \+// and it worked.
Thanks so much,