Question Locked

Extracting single words from a text file

0 helpful
7 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

Hey. Does anybody know of a simple way to extract only particular words from a text file? I've of course tried 'find' and 'findstr' but they will only output the entire line the search is found in. I just want the single word i specify parsed out.

Any suggestions?

7 replies

by dr.engnr

i checked this out but it doesn't seem to have completed command line support. what i'm trying to do is basically extract the "?? ms" column from a tracert output.

by thumbsup2

The text file generated should be a tab separated text file. Just import it into Excel and extract what you want.

by dr.engnr

i know i could import and space delimiter the output.

i'm trying to, from only the command line, have specified words extracted from a text file and place into another (or output on the sreen).

by netman1958

Go to http://unxutils.sourceforge.net/
and download the utilities. Unzip them and copy "cut" to your system32 directory or update your PATH to include the unxutils directory. Then (assuming your file is tab delimited) "cut -fx filename" where "x" is the field number you want to display. If the file isn't tab delimited, you can pass the delimiter to cut with the "-d delimiter" option.

by dr.engnr

Le me just say, those unxutils are fantastic. (the link you provided was dead though, found it elsewhere). I ended up being able to parse it out with the 'cut' program you mentioned.

tracert -d 4.2.2.2 | cut -f6,7,8 -d " " -n

This discussion is closed to new replies.