quick vi problem :| (search and replace)

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • a1ka1ine
    Confirmed User
    • Apr 2002
    • 3387

    #1

    quick vi problem :| (search and replace)

    im trying to search and remove all instances of "../"

    im using %s@../@@gc but its not doing it.. anyone use this program? its fucking voodoo to me
  • FuqALot
    Confirmed User
    • Dec 2001
    • 3817

    #2
    http://kb.iu.edu/data/acoj.html

    or

    http://www.google.com/
    Last edited by FuqALot; 10-06-2005, 01:56 PM.

    Comment

    • a1ka1ine
      Confirmed User
      • Apr 2002
      • 3387

      #3
      Originally posted by FuqALot
      this does not help my problem, but thanks for trying! believed me i used a search engine for 30 minutes and read pages of vi manuals with no success

      Comment

      • FuqALot
        Confirmed User
        • Dec 2001
        • 3817

        #4
        Ok hehe.. you can always open it in pico too, it's an easier editor. vi is kinda outdated

        try: pico file.txt

        Comment

        • FuqALot
          Confirmed User
          • Dec 2001
          • 3817

          #5
          Wait, you want to do ../ right, maybe you should add a backslash in front of the slash, or maybe you should try [../]

          Comment

          • a1ka1ine
            Confirmed User
            • Apr 2002
            • 3387

            #6
            Originally posted by FuqALot
            Ok hehe.. you can always open it in pico too, it's an easier editor. vi is kinda outdated

            try: pico file.txt
            thanks again heh, but the version of pico installed does not do replace for some reason :| and the box doesnt have the right glib library for the newer version and im not messing about with installing stuff i dont know about on a live server :S

            Comment

            • FuqALot
              Confirmed User
              • Dec 2001
              • 3817

              #7
              See, in perl i would have either used the backslash idea or the [../] idea. If they don't do anything, then try: s^../^^g

              if that doesnt do anything then you should get the file to notepad and do it there, but that might leave windows newlines you don't want hehe.

              Comment

              • a1ka1ine
                Confirmed User
                • Apr 2002
                • 3387

                #8
                trying what you suggested now

                Comment

                • a1ka1ine
                  Confirmed User
                  • Apr 2002
                  • 3387

                  #9
                  Originally posted by FuqALot
                  See, in perl i would have either used the backslash idea or the [../] idea. If they don't do anything, then try: s^../^^g

                  if that doesnt do anything then you should get the file to notepad and do it there, but that might leave windows newlines you don't want hehe.
                  swapping out the delimiter is what i tried, and for some reason it finds every occurance of / and not the ../ before it.


                  damn voooddooooooooo :S.

                  !!! i will keep googling

                  Comment

                  • willysbirthday
                    Confirmed User
                    • Feb 2004
                    • 436

                    #10
                    :1,$s/\.\.\///g
                    oOooooooOOo

                    Comment

                    • willysbirthday
                      Confirmed User
                      • Feb 2004
                      • 436

                      #11
                      . is wildcard, it must be escaped
                      / is special char, it must be escaped
                      oOooooooOOo

                      Comment

                      • FuqALot
                        Confirmed User
                        • Dec 2001
                        • 3817

                        #12
                        That's probably since a '.' is usually preserved for something too... that's why I suggested [../] instead of ../, which is the way to go with perl hmm.. i have no idea then.

                        Comment

                        • a1ka1ine
                          Confirmed User
                          • Apr 2002
                          • 3387

                          #13
                          Originally posted by willysbirthday
                          :1,$s/\.\.\///g
                          oh shit - that worked perfectly! thanks! i had no idea a . was also a special character there.. thanks for the help

                          Comment

                          • FuqALot
                            Confirmed User
                            • Dec 2001
                            • 3817

                            #14
                            yay. hehe well.. close :D.

                            Comment

                            • a1ka1ine
                              Confirmed User
                              • Apr 2002
                              • 3387

                              #15
                              Originally posted by FuqALot
                              That's probably since a '.' is usually preserved for something too... that's why I suggested [../] instead of ../, which is the way to go with perl hmm.. i have no idea then.
                              oh well. thanks for helping, and making this the longest thread on gfy about vi - we are setting history!

                              Comment

                              • MrHits
                                Confirmed User
                                • Apr 2003
                                • 236

                                #16
                                forget it.. someone already posted it .


                                doh

                                Comment

                                Working...