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

Author Topic: Read a particular word using DOS?  (Read 3779 times)

0 Members and 1 Guest are viewing this topic.

vinoth124

    Topic Starter


    Rookie

    Read a particular word using DOS?
    « on: September 17, 2008, 05:33:16 AM »
    Hi,

    Is there is any possiblity to read a particular word in a text file. I know where the word will start and end.

    For example:

    Consider the text file contains the following content...,

    ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLM NOPQRSTUVWXYZ
    ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLM NOPQRSTUVWXYZ
    ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLM NOPQRSTUVWXYZ
    ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLM NOPQRSTUVWXYZ

    I need to read the character from 4th position to 9th position of the line1.
    i.e., I need to get "DEFIJK" alone from this text file.

    Will you please help me to resolve the same.

    Thanks in advance...,

    With Regards,
    Vinoth R
     :)

    devcom



      Apprentice

      Thanked: 37
      Re: Read a particular word using DOS?
      « Reply #1 on: September 17, 2008, 06:01:42 AM »
         
      The easiest way:
      Code: [Select]
      @echo off
      set data=ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLM NOPQRSTUVWXYZ
      echo %data%
      set data1=%data:~3,3%
      set data2=%data:~8,3%
      echo %data1%%data2%
      pause
      Download: Choice.exe