Windows Commands: Search for a text string in a file & display all the lines where it is found


FIND-Windows Command

FIND

Search for a text string in a file & display all the lines where it is found.

Syntax
      FIND [/V] [/C] [/N] [/I] "string" [pathname(s)]
key
/V : Display all lines NOT containing the specified string.

/C : Count the number of lines containing the string.
/N : Display Line numbers.
/I : Ignore the case of characters when searching for the string.

"string" : The text string to find (must be in quotes).
[pathname] : A drive, file or files to search.

If a [pathname] is not specified, FIND will prompt for text input or will accept text piped from another command.
(use CTRL-Z to end manual text input)

Examples:

If names.txt contains the following:

  Joe Bloggs, 123 Main St, Dunoon 
  Arnold Jones, 127 Scotland Street, Edinburgh

To search for "Jones" in names.txt

FIND "Jones" names.txt

---------- NAMES.TXT Arnold Jones, 127 Scotland Street, Edinburgh

If you want to pipe a command into FIND use this syntax

TYPE names.txt | FIND "Jones" 

You can also redirect like this

FIND /i "Jones" < names.txt >logfile.txt


To search a folder for files that contain a given search string

FOR %G IN (*.txt) do (find /n /i "SearchWord" "%G")

Searching from Windows Explorer

Because the built-in Windows File Search is broken> you may want to add a find script to the Send To folder. Alternatively Agent Ransack> or other search utilitieswill do the job properly.

Bugs/Limitations
Although FIND can be used to scan large files, it will not detect any string that is positioned more than 1070 characters along a single line (with no carriage return) This makes it of limited use in searching binary or XML file types.

Other Windows 98, Windows XP Commands:
addusers , arp , assoc , associate , at , attrib , browstat , cacls , call , cd , change , chkdsk , chkntfs , choice , cipher , cleanmgr , clip , cmd , color , comp , con2prt , copy , date , defrag , del , delprof , dir , diruse , diskcomp , diskcopy , doskey , dsadd , dsmod , echo , endlocal , exit , expand , expand , fc , fdisk , find , findstr , for , forfiles , format , fsutil , ftp , ftype , global , goto , help , hfnetchk , if , ifmember , ipconfig , kill , label , ldifde , local , logevent , logoff , logtime , mapisend , md , mem , mode , monitor , more , mountvol , move , moveuser , msg , msiexec , msinfo32 , mstsc , munge , mv , nbtstat , net , netdom , netsh , netstat , netsvc , now , nslookup , ntbackup , ntrights , path , pathping , pause , perms , ping , popd , portqry , print , prncnfg , prnmngr , prompt , pushd , qgrep , rasdial , rasphone , rd , rdisk , recover , reg , regedit , regsvr32 , rem , ren , replace , rmtshare , robocopy , route , runas , rundll32 , sc , schtasks , sclist , scriptit , set , setlocal , setx , share , shift , shortcut , showgrps , showmbrs , shutdown , sleep , soon , sort , start , su , subinacl , subst , tasklist , time , timeout , title , touch , tracert , type , ver , verify , vol , where , whoami , windiff , winmsd , winmsdp , wmic , xcacls , xcopy ,
Live2Support.com :
Product - Benefits - Features - How Does it Works - Pricing - SSL Certificates - Signup - Contactus - Login - Submit Resources