Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Nov 2012
    Thanked 0 Times in 0 Posts

    Online tool for repetitive text operations

    Hi guys, I just wanted to hear you opinion on this topic.
    I recently needed to convert a long list looking like this:
    to this format:
    I could not find anything from a quick Google search that would help me except for programs that needed to be downloaded. I decided to make an online tool for doing different kind of text operations.
    You can check it out at http://www.textmacro.com
    I would like to know if I am the only one who has needed such a tool or if you know about other existing tools?

  2. AdSlot6
  3. #2
    Regular Coder stevenmw's Avatar
    Join Date
    Jun 2007
    Thanked 31 Times in 31 Posts
    I use my Linux terminal to do it. I simply use grep to find things in files, and then I use sed to go through the file and replace whatever I want.

    Say I have a ton of PHP files, and I wanted to find a single word or sequence of words.
    grep -r -i -l "keyword" *.php

    The * is a wild card. It represents what to look for. It my example it looks for anything ending with .php You can put things before the * and it will look for anything starting with what you specify and ending in anything One example would be hidden files. Hidden files start with a period so I could do.

    grep -r -i -l "keyword" .*

    -r recursive (will search folder and subfolders)
    -i case insensitive (ignores UPPERCASE or lowercase)
    -l list only (displays names of files found only)

    to find and replace
    grep -rl 'this' /some_directory/ | xargs sed -i 's/this/that/g'

    The above line would replace all instances of 'this' with 'that'

    This is one huge reason I really like Linux. There are so many regex options to use with the grep and sed commands.

    You can replace all lower case instance to upper case, replaces spaces with underscores, etc. All using one line.

    You can build long complicated regexes to do all kinds of things.
    Last edited by stevenmw; 12-05-2012 at 03:26 PM.

  4. #3
    New to the CF scene
    Join Date
    Dec 2012
    Thanked 0 Times in 0 Posts
    I think pHP code wil help you out for the purpose. Best to discuss with a programmer (dot net,Php) he will guide you.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts