ProfilLlogFotosBlogListen Extras Hilfe

Blog


    09 April

    global search and replace in vi

    http://kb.iu.edu/data/acoj.html
    http://kb.iu.edu/data/acux.html
    http://kb.iu.edu/data/afrk.html
    Invoke vi's edit mode by pressing the Esc key, then a colon ( : ), and enter:
    1,$s/oldstring/newstring/g

    This will change oldstring into newstring wherever it occurs throughout the entire text. The 1 (the number one) in the above command means "start the search on the first line". The $ means "end the search on the last line". The g at the end executes the change globally on each line. If you omit the g , the search will stop after finding the first occurrence of oldstring.
    http://www.issociate.de/board/post/235976/sed_and_newline_(x0a).html