[olug] Unix Tip: APPENDING TEXT AT BOTH ENDS
Unix Guru Universe
listserv at ugu.com
Wed Jul 30 16:50:09 UTC 2003
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
UNIX GURU UNIVERSE
UNIX HOT TIP
Unix Tip 2037 - July 30, 2003
http://www.ugu.com/sui/ugu/show?tip.today
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
APPENDING TEXT AT BOTH ENDS
If you need to append some
text to both the ends of a
string in vi, use the
following command in vi:
:/^\(.*\)/s//starttextcomeshere \1 endtextcomeshere/
If "iamworthless" is the text
at the position of the cursor
in the vi editor, the output
of the command:
:/^\(.*\)/s//DONTFEEL \1 ANYTIME/
DONTFEEL iamworthless ANYTIME
As you guessed, "DONTFEEL " and
" ANYTIME" are the strings you
would like to crush
"iamworthless" with. The "\1" is
the variable that stores the
entire pattern searched by
the "/\(.*\)/"
This tip generously supported by: hg_krishnan at yahoo.com
--------------------------------------------------------------------------
To Subscribe: http://www.ugu.com/sui/ugu/show?tip.subscribe
To Unsubscribe: http://www.ugu.com/sui/ugu/show?tip.unsubscribe
To Submit A Tip: http://www.ugu.com/sui/ugu/show?tip.today
==========================================================================
DISCLAIMER: All UNIX HOT TIPS ARE OWNED BY THE UNIX GURU UNIVERSE AND ARE
NOT TO BE SOLD, PRINTED OR USED WITHOUT THE WRITTEN CONSENT OF THE UNIX
GURU UNIVERSE. ALL TIPS ARE "USE AT YOUR OWN RISK". UGU ADVISES THAT
ALL TIPS BE TESTED IN A NON-PRODUCTION DEVELOPMENT ENVIRONMENT FIRST.
Unix Guru Universe - www.ugu.com - tips at ugu.com - Copyright 1994-2001
==========================================================================
More information about the OLUG
mailing list