Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. File content transformation tool

File content transformation tool

Scheduled Pinned Locked Moved The Lounge
comtools
4 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    Phil Harding
    wrote on last edited by
    #1

    Anyone know of any tools around which can perform file content transformation based on token replacement; i.e. process "*.ext" and replace these tokens with these values


    - "I'm not lying, I'm just writing fiction with my mouth"

    Phil Harding.
    myBlog [^] | mySite [^]

    J E R 3 Replies Last reply
    0
    • P Phil Harding

      Anyone know of any tools around which can perform file content transformation based on token replacement; i.e. process "*.ext" and replace these tokens with these values


      - "I'm not lying, I'm just writing fiction with my mouth"

      Phil Harding.
      myBlog [^] | mySite [^]

      J Offline
      J Offline
      James R Twine
      wrote on last edited by
      #2

      I am not certain, having not touched anything U*nix-ish in a while, but I think that (GNU) SED[^] was designed for things like that.  You can also see Here[^] for a non-GNU-specific site. Edit:    From the One Liners Page[^]

      substitute (find and replace) "foo" with "bar" on each line

      sed 's/foo/bar/' # replaces only 1st instance in a line
      sed 's/foo/bar/4' # replaces only 4th instance in a line
      sed 's/foo/bar/g' # replaces ALL instances in a line
      sed 's/\(.*\)foo\(.*foo\)/\1bar\2/' # replace the next-to-last case
      sed 's/\(.*\)foo/\1bar/' # replace only the last case

      Peace!

      -=- James
      Please rate this message - let me know if I helped or not! * * * If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong!
      Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road!
      See DeleteFXPFiles

      1 Reply Last reply
      0
      • P Phil Harding

        Anyone know of any tools around which can perform file content transformation based on token replacement; i.e. process "*.ext" and replace these tokens with these values


        - "I'm not lying, I'm just writing fiction with my mouth"

        Phil Harding.
        myBlog [^] | mySite [^]

        E Offline
        E Offline
        Ed Poore
        wrote on last edited by
        #3

        Well your a programmer so... :rolleyes:  I've just got a couple of my own C# scripts to do this for me. Otherwise ls -> grep -> mv -> whatever. ;P Ps, you can download native Windows versions of these from gnuwin32[^]

        1 Reply Last reply
        0
        • P Phil Harding

          Anyone know of any tools around which can perform file content transformation based on token replacement; i.e. process "*.ext" and replace these tokens with these values


          - "I'm not lying, I'm just writing fiction with my mouth"

          Phil Harding.
          myBlog [^] | mySite [^]

          R Offline
          R Offline
          Rocky Moore
          wrote on last edited by
          #4

          Not quite sure what you mean by tokens and values. If you are looking for a search and replace on specific file types, VS does that..

          Rocky <>< Latest Code Blog Post: OpenID - More thought - Great system if.. Latest Tech Blog Post: Frustrated Total Internal Reflection-FTIR = Cool!

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups