Loading ...
Sorry, an error occurred while loading the content.

49555RE: >> help with scripting vim

Expand Messages
  • owen beresford
    Apr 22, 2004
    • 0 Attachment
      On Thu, 22 Apr 2004 15:07:14 -0500, "Sean C. Hubbell" <sch@...>
      said:
      > %s!192\.168\.1\.1!192\.168\.1\.2!g
      >
      > % - global
      > s - substitute
      > . needs to be escaped as it is a special character
      > ! -just the delimiter I used
      > g - all occurrences on the line
      >
      > I have a perl script that I wrote a while back that globs files in the
      > current directory. I do not know if you have perl installed, but if you
      > would like it I will send it to you (I will not send attachments to the
      > list). The example usage is
      >
      > snr.pl OldPattern NewPattern File/s
      >
      If you have bash why not use it?
      there are probably betterways of writting this but:

      subs="s/192\.168\.1\.1/192\.168\.1\.2/"
      #or set to what ever values you like
      pattern='*.c'
      #or whatever group of files you like
      #remove the pattern entirely to get ALL files

      for fn in $(ls $pattern)
      do
      #stream through sed, as other poster suggested
      sed -e $subs $fn
      done


      --
      owen beresford
      owencanprogram@...

      --
      http://www.fastmail.fm - mmm... Fastmail...
    • Show all 9 messages in this topic