Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: Need Help: How to replace Text string on File  (Read 3431 times)

0 Members and 1 Guest are viewing this topic.

jik

    Topic Starter


    Rookie

    Need Help: How to replace Text string on File
    « on: April 01, 2009, 05:37:19 AM »
    Hi,

    I need to Replace a text on file and save it to another filename. I know this can be done in the aplication it self "Replace". But ex. if you need 100 same file just different filename and you will just need to replace a text or "name" in a file.

    ex. Need to replace "1" with "A"

    Filename "1.txt"
    2 3 4 1 2 3 1
    1 2 3 4 5 6 7 8 9 1

    and save this to diffrent filename "A.txt"

    ghostdog74



      Specialist

      Thanked: 27
      Re: Need Help: How to replace Text string on File
      « Reply #1 on: April 01, 2009, 06:38:24 AM »
      Hi,

      I need to Replace a text on file and save it to another filename. I know this can be done in the aplication it self "Replace". But ex. if you need 100 same file just different filename and you will just need to replace a text or "name" in a file.

      ex. Need to replace "1" with "A"

      Filename "1.txt"
      2 3 4 1 2 3 1
      1 2 3 4 5 6 7 8 9 1

      and save this to diffrent filename "A.txt"


      if you are able to download stuffs, you can use sed (check my sig for link).
      Example for 1 file
      Code: [Select]
      c:\test> sed -i "s/1/A/g" file
      2 3 4 A 2 3 A
      A 2 3 4 5 6 7 8 9 A
      example file multiple files
      Code: [Select]
      c:\test> sed -i "s/1/A/g" file*.txt



      jik

        Topic Starter


        Rookie

        Re: Need Help: How to replace Text string on File
        « Reply #2 on: April 01, 2009, 06:50:14 AM »
        what is "sed"?

        ghostdog74



          Specialist

          Thanked: 27
          Re: Need Help: How to replace Text string on File
          « Reply #3 on: April 01, 2009, 06:54:03 AM »
          what is "sed"?
          doesn't take much time to look it up

          Dias de verano

          • Guest
          Re: Need Help: How to replace Text string on File
          « Reply #4 on: April 01, 2009, 09:50:19 AM »