Extracting text
Results 1 to 7 of 7

Thread: Extracting text

  1. #1
    Senior Member
    Join Date
    May 2004
    Posts
    206

    Extracting text

    How would you extract text from the MS-DOS command line? For example:
    echo dir > new.txt

    How would you get it to input "dir" into the command line. I know in that instance you could just pipe it into new.bat, but I want to know for any general curcumstance.
    It is better to die on your feet than to live on your knees.

  2. #2
    Senior Member
    Join Date
    Sep 2003
    Posts
    500
    tree > file.txt
    or
    dir /p > file.txt

    if you want more options for "tree" and "dir," simply type "help" before the command.
    You shall no longer take things at second or third hand,
    nor look through the eyes of the dead...You shall listen to all
    sides and filter them for your self.
    -Walt Whitman-

  3. #3
    Senior Member
    Join Date
    May 2004
    Posts
    206
    That pipes the info into file.txt , but I want to extract the information from file.txt .
    It is better to die on your feet than to live on your knees.

  4. #4
    Senior Member
    Join Date
    Feb 2004
    Posts
    620
    Here's what I did. The contents of file.txt:

    dir
    Then in the command prompt I typed:

    cmd < file.txt
    And it ran the dir command.

    mjk

  5. #5
    Senior Member
    Join Date
    Sep 2003
    Posts
    500
    oh, okay I understand now. That or this

    more filename.txt | cmd
    You shall no longer take things at second or third hand,
    nor look through the eyes of the dead...You shall listen to all
    sides and filter them for your self.
    -Walt Whitman-

  6. #6
    Senior Member
    Join Date
    May 2004
    Posts
    206
    Ok, what if new.txt contained
    192.168.1.100

    and I wanted to have a program ping the IP from the txt file. How could I do that?
    It is better to die on your feet than to live on your knees.

  7. #7
    Senior Member
    Join Date
    Feb 2004
    Posts
    620
    I don't think there's a way to do that with one command but if you has something like this in a batch file:

    set a = more new.txt
    ping a


    ..except I don't know how to use variables in batch files! You get the idea though.

    mjk

Posting Permissions

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