FINDSTR command to find a hyphen

Microsoft Windows vista business - 3 pac...
March 3, 2010 at 17:22:43
Specs: Windows Vista
I am attempting to use the FINDSTR command to find all lines that have a hyphen. For example, I have a file.

123-123-123-123
456456456456

I have tried many ways, but I believe that the hyphen is a special character.

FINDSTR "-" temp2.tmp > temp.tmp
FINDSTR /C:"-" temp2.tmp > temp.tmp
FINDSTR /L "-" temp2.tmp > temp.tmp
FINDSTR /C:"\-" temp2.tmp > temp.tmp
FINDSTR /C:"^-" temp2.tmp > temp.tmp
FINDSTR /R "\-" temp2.tmp > temp.tmp

None of these lines seem to work.

Can anyone help me to find all lines containing a hyphen?

Thank you.


See More: FINDSTR command to find a hyphen

Report •

#1
March 4, 2010 at 02:26:01
Use the find command instead of findstr

type temp2.tmp | find "-" > temp.tmp

For questions about system commands and batch scripting post in the Programming Forum where there is a lot of guys ready to help.

Report •
Related Solutions


Ask Question