What I usually do from bash/vim ... is
- open file with vim
- go to line to comment
- comment a line
- save and quit
My file is
/usr/local/etc/php/7.0/conf.d/ext-xdebug.ini and the initial content is
I want to run a command that in one statement adds
; at the beginning of the second line.
Is it possible to do this directly from bash?
sed -i '2 s/^/;/' fileto add
;at beginning of 2nd line and
sed -i '2 s/.//' fileto delete first character from 2nd line... see this for more such examples and this for use of
-iflag for different sed versions
;in question to show before and after example