- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: vi question
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-14-2004 04:38 AM
07-14-2004 04:38 AM
vi question
How to add a blank line in any line containing a string "endif"
eg :
endunstring endfi
will result in
endunstring
endif
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-14-2004 04:45 AM
07-14-2004 04:45 AM
Re: vi question
Do the following whenever u required ,
keep the cursor at endif position.
Step 1:
Esc
" a yy 1 #itwill yank that line in buf a.
when need to add a blank line with endif
step 2:
keep the cursor there .
Esc " a p # it will paste "endif"
Cheers.
Raj D.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-14-2004 04:45 AM
07-14-2004 04:45 AM
Re: vi question
:g/\
then remove the empty line again
if you have a more feature rich vi clone like elvis, you can do
:g/\
Enjoy, Have FUN! H.Merijn
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-14-2004 04:46 AM
07-14-2004 04:46 AM
Re: vi question
/endif
o
esc
Rgds...Geoff
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-14-2004 04:48 AM
07-14-2004 04:48 AM
Re: vi question
Rgds...Geoff
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-14-2004 04:51 AM
07-14-2004 04:51 AM
Re: vi question
Personally I'd use perl for that:
# perl -pi -e's/\s+endif\s*$/\nendif/' file
which will do what you want as an in-line replacement
Enjoy, Have FUN! H.Merijn
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-14-2004 04:59 AM
07-14-2004 04:59 AM
Re: vi question
Well here is the very simple answer :
in vi , do the following , from u are begining of the file , do :
Esc :%s/endif/ /g
This will replace all "endif" by a "blank line"
Cheers ,
Raj D.
-------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-14-2004 05:05 AM
07-14-2004 05:05 AM
Re: vi question
:g/\
but I end up with
endifn
at all instances of endif
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-14-2004 05:14 AM
07-14-2004 05:14 AM
Re: vi question
Try out my last one and give me feedback pls. Whether it fulfills the purpose..
regards
Raj D.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-14-2004 05:25 AM
07-14-2004 05:25 AM
Re: vi question
Your replace endif with space
How to replace with blank line, control characters?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-14-2004 06:15 AM
07-14-2004 06:15 AM
Re: vi question
You get the ^M by depressing and holding the ctrl-V and then the 'm'
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-14-2004 08:47 AM
07-14-2004 08:47 AM
Re: vi question
You can try with the 'at' character, like this
:%s@endif@^Mendif@
the %s means in whole file.
you can get the ^M like Mike_Ca Li says with CTRL-V and then CTRL-M.
this works for me.
Frank
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-14-2004 10:24 AM
07-14-2004 10:24 AM
Re: vi question
sed -e 's/endif/\nendif/g' yourfile
Rgds...Geoff