danbowden Posted May 25, 2005 Share Posted May 25, 2005 In the script I am writing I wish to search a log file for a string of text string of text. Is this easy to do? I can't really find anything simple (This is a quite large text file so I don't really want to read it as a string and search the string from there) Thanks in advance for any help you guys can give Dan Link to comment Share on other sites More sharing options...
sandyd Posted May 25, 2005 Share Posted May 25, 2005 (edited) Try using the DOS command find, and pulling the output of that: find /? Searches for a text string in a file or files. FIND [/V] [/C] [/N] [/I] [/OFF[LINE]] "string" [[drive:][path]filename[ ...]] /V Displays all lines NOT containing the specified string. /C Displays only the count of lines containing the string. /N Displays line numbers with the displayed lines. /I Ignores the case of characters when searching for the string. /OFF[LINE] Do not skip files with offline attribute set. "string" Specifies the text string to find. [drive:][path]filename Specifies a file or files to search. If a path is not specified, FIND searches the text typed at the prompt or piped from another command. If you need help, just PM me. Edited May 25, 2005 by sandyd ----[ SandyD ]--- Link to comment Share on other sites More sharing options...
danbowden Posted May 25, 2005 Author Share Posted May 25, 2005 Thats great thankyou!Try using the DOS command find, and pulling the output of that:find /? Searches for a text string in a file or files. FIND [/V] [/C] [/N] [/I] [/OFF[LINE]] "string" [[drive:][path]filename[ ...]] /V Displays all lines NOT containing the specified string. /C Displays only the count of lines containing the string. /N Displays line numbers with the displayed lines. /I Ignores the case of characters when searching for the string. /OFF[LINE] Do not skip files with offline attribute set. "string" Specifies the text string to find. [drive:][path]filename Specifies a file or files to search. If a path is not specified, FIND searches the text typed at the prompt or piped from another command.If you need help, just PM me.<{POST_SNAPBACK}> Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now