UGU: Unix Guru Universe - Unix Tip #4608- October 23, 2017
- Home : Help
: Today's Tip
Unix Tip #4608- October 23, 2017
COMMENT OUT MULTIPLE LINES
Ever wanted to comment out
multiple lines of code while
scripts in vi, but didn't want
to pound your keyboard for half
an hour doing it?
(I#Escape j.j.j.j. = carpal tunnel)
Here's the nerdy way to do it:
Where N-1 is the number of lines
minus one that you want to comment
out, and s/^/#/g is the regular
expression (the pattern between the
first two slashes is what you want
to replace, in this case the
beginning of the line, and the
pattern between the last two slashes
is what you want to replace it with).
For example, if you're a bad
coder like me and want to comment
out 500 lines of code, you would do:
This tip generously supported by: firstname.lastname@example.org
NOTE: All tips provided are USE AT YOUR OWN RISK. Tips are submitted
by various unix admins around the globe. UGU suggest you read and
test each tip in a non-volitile environment before placing into
LAST 5 TIPS
- HOW MUCH SOLARIS MEMORY?
- EDITING OF LARGE FILES
- LEAKING MEMORY?
- TRUSS THE PID.....
- VERIFY AFTER VACATIONS
I want to
and get a UGU Tip everyday.
I want to
and NOT get a UGU Tip everyday.
If you have a UNIX TIP let us know, we just may use it:
(All tips become the property of the Unix Guru Universe)
Copyright 1994-2018 Unix Guru Universe