Sunteți pe pagina 1din 2

Usage example of Command-line findstr (Find String) within a file

findstr is a DOS tool that searches content of a text file and displays the occurrences

Name of the sample file test.txt, content of test.txt :
abcde1
abcde2
abcde3
fghij1
fghij2
fghij3
klmno1
klmno2
klmno3

On DOS/CMD console:
C:\Users\my.user\Desktop>type test.txt <------ to display what the file has
abcde1
abcde2
abcde3
fghij1
fghij2
fghij3
klmno1
klmno2
klmno3

C:\Users\my.user\Desktop>findstr /C:"1" test.txt <------ display the strings that have 1 on them
abcde1
fghij1
klmno1

C:\Users\my.user\Desktop>findstr /C:"abcde" test.txt <------ display the strings that have abcde
on them
abcde1
abcde2
abcde3

S-ar putea să vă placă și