![]() |
|
|
|||||||
| Petri.co.il is happy to award auglan the title of Most Valuable Member !!! |
| Register | Calendar |
Search |
Today's Posts |
Mark Forums Read |
| Notices |
|
|
DOS Batch to Find String in All Filesthis thread has 1 replies and has been viewed 2614 times
|
![]() |
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
||||||||
|
||||||||
|
Hi,
I'm struggling with the correct DOS Batch commands (XP and W7) to find a specific character "@" in any and all text files in one directory and to count those occurences. Here's what I've got, but still returning 0 count. If I put a specific file name in the FOR command, it WILL count any "@" that it finds. But doesn't seem to work with "." or "*.*) in the fileset parm which should cause the FOR command to read thru ALL files. I'm trying to display the found tokens with the %%G but that doesn't work. Not necessary, just for debugging. Any help is very appreciated. Code:
REM Find and count all files with email addresses REM Assume any user_data record with @ is valid email address FOR /F "delims=@ eol=`" %%G IN (.) DO (CALL :CHECK %%G) echo ( echo Number of Emails Sent = %count% echo ( GOTO :eof :CHECK %%G set _DataIn=%%G echo CHECK %_DataIn% set /a count+=1 GOTO :eof Last edited by Rems; 16th August 2012 at 18:32.. Reason: added [CODE] tags |
|
#2
|
||||||||
|
||||||||
|
I think I've found it:
Code:
findstr /R /N "@" *.* | find /c ":" |
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Help: input data to a string/remove the string leaving only the data using batch file | Slow | DOS Command Shell | 1 | 23rd September 2011 14:55 |
| Batch file to filter and rename string in txt file | Antediluvian | DOS Command Shell | 2 | 2nd July 2010 10:51 |
| Batch Script: Delete files based on files listed in a text document | Fr0stb1t3 | DOS Command Shell | 7 | 6th May 2010 11:00 |
| Batch Scripting - how to read a string value from a text file | albert_newton | General Scripting | 2 | 6th August 2009 19:44 |
| Find string in .txt from a list of computers | Lan | General Scripting | 4 | 11th September 2007 12:03 |