Halaman

Imam Ali Ibn Abi Thalib as

Barangsiapa yang rindu kepada surga, dia akan berpaling dari tuntutan hawa nafsunya.
Barangsiapa yang takut api neraka, dia akan menjauhi hal-hal yang terlarang.
Barangsiapa yang zuhud (tidak rakus) terhadap dunia, dia akan menganggap ringan suatu musibah
Barangsiapa yang bersiap-siap menghadapi kematian, dia akan bersegera melakukan kebaikan

Search




Wednesday, November 7, 2007

UNIX - Search and Replace in vi editor

This is about as complicated as it gets in vi, since search and replace sytnax is taken from the UNIX sed (stream editor) command.

>> Global search and replace --> :1,$ s/old/new/g

In english, this means:
From 1 to $ (end of file)
substitute
occurrences of "old"
with occurrences of "new"
globally (i.e., all instances of "old")

I won't go into details on using sed in this section (see the UNIX sections on sed and regular expressions), but you can easily change the range to search and replace from by changing "1" and "$" to your needs.

No comments:

Post a Comment

Subscribe

Enter your email address:

Delivered by FeedBurner