I need advanced search and replace technique and short icq

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Wolfy
    Confirmed User
    • Dec 2003
    • 3574

    #1

    I need advanced search and replace technique and short icq

    I want to replace all the <!---blah blah--->'s in my site - how do I do that besides a search replace with different amounts of wildcards?

    I could do it one at a time, search and replace <!---*--->, <!---**--->, <!---***--->, etc - but that sucks donkeyballs.
  • Wolfy
    Confirmed User
    • Dec 2003
    • 3574

    #2
    not even a short icq?

    Comment

    • Antonio
      Too lazy to set a custom title
      • Oct 2001
      • 14136

      #3

      you can replace any string in all the files (html etc) in the same folder

      Comment

      • TonyL
        Confirmed User
        • Feb 2002
        • 900

        #4
        HomeSite has a pretty decent advance replace as well.

        -Tony

        Comment

        • Wolfy
          Confirmed User
          • Dec 2003
          • 3574

          #5
          you showed me that the other night when I was looking for something different. How will this handle the wildcard strings?

          Comment

          • Wolfy
            Confirmed User
            • Dec 2003
            • 3574

            #6
            downloading homesite now, thnaks.

            Comment

            • Antonio
              Too lazy to set a custom title
              • Oct 2001
              • 14136

              #7
              Wolfy I'm not sure I'm understanding exactly what you want to do
              Anyway good luck. Hope the hosite does it for you.

              Comment

              • Wolfy
                Confirmed User
                • Dec 2003
                • 3574

                #8
                "hosite" doesn't look like it has what I want... I have a site that i want to find and replace a bunch of stuff in, and it all starts with "<!-----" and ends with "------>". A find and replace search with a wildcard (*) will not work because (*) only covers one character, I need something to handle multiplecharacters between two consistent variables ("<!---" and "--->"). I know there's a way to do this, help me people!

                Comment

                • - Jesus Christ -
                  Confirmed User
                  • Mar 2003
                  • 7197

                  #9
                  http://www.boolean.ca/replace/

                  extremely powerful replacement tool

                  One of my secret weapons. (well its not really a secret)

                  Amen

                  Comment

                  • rickholio
                    Confirmed User
                    • Jan 2004
                    • 1914

                    #10
                    Shame you're not using some variety of unix... a simple regex would cover it:

                    sed 's/<!--.*blah.*-->/<!-- foo -->/g' < oldfile.html > newfile.html

                    Guess it's a little more complex in other OSes.
                    ~

                    Comment

                    • - Jesus Christ -
                      Confirmed User
                      • Mar 2003
                      • 7197

                      #11
                      Originally posted by rickholio
                      Shame you're not using some variety of unix... a simple regex would cover it:

                      sed 's/<!--.*blah.*-->/<!-- foo -->/g' < oldfile.html > newfile.html

                      Guess it's a little more complex in other OSes.
                      Yes I love linux too, but lets not kid ourselves... having a graphical interface to do complicated string replacement makes things a lot easier.

                      Try using your method to replace a large paragraph of text using regular expressions and variables. its a lot less "complex" to do it with BK replace em.

                      Amen

                      Comment

                      • rickholio
                        Confirmed User
                        • Jan 2004
                        • 1914

                        #12
                        Originally posted by - Jesus Christ -
                        Yes I love linux too, but lets not kid ourselves... having a graphical interface to do complicated string replacement makes things a lot easier.

                        Try using your method to replace a large paragraph of text using regular expressions and variables. its a lot less "complex" to do it with BK replace em.
                        I do complex search/replaces with regularity, but I suppose it comes down to which tools you're familiar with. Generally, graphical search/replace tools aren't readily available for *nix based machines simply because the commline tools have been around in essentially the same form for 20+ years and everyone knows them. ;)
                        ~

                        Comment

                        • Wolfy
                          Confirmed User
                          • Dec 2003
                          • 3574

                          #13
                          wow you guys are l33t.


                          thanks for the bk, cool program JC

                          Comment

                          • - Jesus Christ -
                            Confirmed User
                            • Mar 2003
                            • 7197

                            #14
                            Originally posted by rickholio
                            I do complex search/replaces with regularity, but I suppose it comes down to which tools you're familiar with. Generally, graphical search/replace tools aren't readily available for *nix based machines simply because the commline tools have been around in essentially the same form for 20+ years and everyone knows them. ;)
                            You missed my point.

                            Command line tools CANT do some things BK can with regular expressions and multiple files. Not to mention saving replacement sets and settings to suit a specific website/project.

                            Amen

                            Comment

                            • Webby
                              Too lazy to set a custom title
                              • Oct 2002
                              • 14956

                              #15
                              Wolfy:

                              If the content is on a local drive... try CodeSwitcher.

                              This will trail thru sub dirs and replace simple or complete blocks of html code and replace it with whatever you want.
                              XXX TLD's - Another mosquito to swat.

                              Comment

                              • rickholio
                                Confirmed User
                                • Jan 2004
                                • 1914

                                #16
                                I'm not sure I follow... I do advanced s/r's on multiple files all the time. Some simple shell scripting allows me to cycle through the files, rename for backup or put the new versions in a separate directory, etc. Something like the following:

                                mkdir newstuff
                                for a in *.php
                                do
                                sed 'some replacement string here' < $a > newstuff/$a
                                done

                                Or am I still missing your point?
                                ~

                                Comment

                                • - Jesus Christ -
                                  Confirmed User
                                  • Mar 2003
                                  • 7197

                                  #17
                                  Originally posted by rickholio
                                  I'm not sure I follow... I do advanced s/r's on multiple files all the time. Some simple shell scripting allows me to cycle through the files, rename for backup or put the new versions in a separate directory, etc. Something like the following:

                                  mkdir newstuff
                                  for a in *.php
                                  do
                                  sed 'some replacement string here' < $a > newstuff/$a
                                  done

                                  Or am I still missing your point?
                                  Yea becasue your hanging on to somthing becasue its old and it makes you feel cool to know unix.

                                  You have never even used the software in question yet your gonna argue to the ends of the earth that you can do it with command line.

                                  Your comment was "its more complex" with this software and its its not. (you can replace an UNLIMITED sized paragrah in as many files as you want without scripting... you were talking about command line replacemnt methods now your suddenly going into scripting somthing to do replacement)
                                  So thump the unix bible elseware untill you actually try using the software your claiming your command line skills trump.

                                  Amen

                                  Comment

                                  • Wolfy
                                    Confirmed User
                                    • Dec 2003
                                    • 3574

                                    #18
                                    JC, gettin down on the farm babeeeeee!

                                    Comment

                                    • Antonio
                                      Too lazy to set a custom title
                                      • Oct 2001
                                      • 14136

                                      #19
                                      Wolfy
                                      The progr that I use uses regular expressions as well (as you can see from the screenshot) and can get the job done, but the one that JC recommended looks much easier to use - just downloaded it and I'm checking it out.

                                      Comment

                                      • - Jesus Christ -
                                        Confirmed User
                                        • Mar 2003
                                        • 7197

                                        #20
                                        Actually handy File is easier to use but I like BK becasue it allows you to do more and arrange/save stuff in file sets.

                                        Amen

                                        Comment

                                        • rickholio
                                          Confirmed User
                                          • Jan 2004
                                          • 1914

                                          #21
                                          Originally posted by - Jesus Christ -
                                          Yea becasue your hanging on to somthing becasue its old and it makes you feel cool to know unix.

                                          You have never even used the software in question yet your gonna argue to the ends of the earth that you can do it with command line.

                                          Your comment was "its more complex" with this software and its its not. (you can replace an UNLIMITED sized paragrah in as many files as you want without scripting... you were talking about command line replacemnt methods now your suddenly going into scripting somthing to do replacement)
                                          So thump the unix bible elseware untill you actually try using the software your claiming your command line skills trump.
                                          Wow... what's with all the hate? All I said is that it possible to do simple replacements with a 1 liner, and possible to do complex multifile replacements with some simple scripting. I never claimed anything was 'superior' nor the task more 'complex', only that the tools to do the task aren't available out of the box and require additional software. That's hardly a barrier to task completion.

                                          In fact quite explicitly said that whatever tool one is comfortable with is the one that'll be tapped to do the job. If the end result is that everything that needs to be searched and/or replaced gets done, then what's the difference aside from the comfort level of the person using it?

                                          You have something against unix? Did a unix guru anally violate your mother or something?
                                          Last edited by rickholio; 01-09-2005, 12:02 AM.
                                          ~

                                          Comment

                                          Working...