#1
  1. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2003
    Location
    city of sin, state of the art
    Posts
    421
    Rep Power
    0

    Question Finding and Removing Lines in vi


    ok i am verrrry new to unix (bash) and even newer to vi editor so bear with me

    2 things..

    A)
    i have read through the man for find an regex and can not figure out for the life of me how to find specificaly 2 different file types...

    like if i want to find all the html files in a dir i do...

    Code:
    find . -type f -name "*.html" >/tmp/allHTML.txt
    but how can i search for both html and htm files?

    i also tried...

    find . -type f -name "*.htm" -or "*.html"
    find . -type f -name *.ht[m|ml]

    as well as many variations of that and no luck.

    B)

    also....i have another txt file that is an enormous list of filepaths/files.

    the question is...is there a way that i can go into vi, search for soemthing and then delete that line if it is found?

    so if it finds "*blurb*" then delete that entire line


    does this make any sense at all?

    i would sooooo greatly appreciate any help on this!!!

    thanks in advance!!

    ROCK ON!!
    "I hate quotations."
    -ralph waldo emerson-
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2003
    Location
    India
    Posts
    61
    Rep Power
    11
    For A use the following

    $ find . -type f -name \*\.htm\*
    ./try.htm
    ./try.html
    $


    Here * . has special meanings and they are escape sequences so it should be protected by putting \


    For B

    you can do the following

    <Esc>:/blurb/d

    <Esc>:/"pattern or string"/d

    That' s it

    Regards
    JK
    Last edited by jayakhanna; December 22nd, 2003 at 01:49 AM.
    Regards
    JK

IMN logo majestic logo threadwatch logo seochat tools logo