Skip to main content

Batch file search for text and count lines

Hi all,
I had just finish a batch file which will search for certain string in a file then count the number of lines with the string. Its great for searching through logfile.

Points to take note:
Remember to put Logfile.txt and countData.bat in the same folder.
%1 is actually the value that the user can pass in.
Logfile.txt is the file that you are searching in.

There is 2 ways to get the batch file to work. One is type countData.bat "stringThatYouWantToSearch" in the command prompt.

Second is create another batch file and type countData.bat "stringThatYouWantToSearch" in that batch file. Then double click on it to run it.

Click Here for the Code with Megaupload

or just copy the code below and paste it into a text file and rename it into countData.bat

del sorted01.txt
del count.txt

type Logfile.txt| findstr /I/C:%1 >> sorted01.txt

find /v /c "hahaharandomword" sorted01.txt >> count.txt

echo -------------------------------------------- >> count.txt

del sorted01.txt

Comments

Popular posts from this blog

Today's Forex Focus, 30 Jan 2024

 Ah, nephew, let's dive into the Forex market today, shall we? It's like peering into a crystal ball, but with a bit more logic and a lot less mysticism. First up, we've got the EUR/USD pair showing a bit of a bearish tilt. The dollar's holding steady like a rock in a stream, buoyed by investors who've got their eyes glued to the upcoming Federal Reserve policy meeting. There's a bit of a buzz about geopolitical tensions in the Middle East, making investors a bit jittery and giving the dollar a bit of a boost​​. Then, there's talk about the Federal Reserve potentially pushing back against the idea of a rate cut anytime soon. This is like a plot twist in a thriller movie for the traders, who are now less convinced about a rate drop in March. The dollar, meanwhile, is flexing its muscles a bit, up by 0.19% against a basket of currencies. Across the pond, the Euro's taken a bit of a tumble, and there's chatter about when the European Central Bank might ...

Kindle Paperwhite

First-Ever Paperwhite Display Brilliant Resolution Our Paperwhite display offers 62% more pixels, and renders exceptionally sharp, clear text and images. Stunning Contrast Kindle Paperwhite's screen has 25% higher contrast. Crisp, dark text against a brilliant white background makes for the perfect read. Innovative Built-in Light Paperwhite guides light towards the display from above instead of projecting it out at your eyes like back-lit displays, thereby reducing screen fatigue. You can adjust your screen's brightness to create a perfect reading experience in all lighting conditions, from bright sunlight to bedtime reading. Uncompromised Battery Life A single charge lasts up to eight weeks, based on a half hour of reading per day with wireless off and the light setting at 10. Our breakthrough power management technology allows you to leave the light on at all times for the best possible contrast without sacrificing battery life. Read ...

Is Currency Carry Trade worth investing?

  What is Currency Carry Trade? "A strategy in which an investor sells a certain currency with a relatively low interest rate and uses the funds to purchase a different currency yielding a higher interest rate. A trader using this strategy attempts to capture the difference between the rates, which can often be substantial, depending on the amount of leverage used. " quoted from http://www.investopedia.com/terms/c/currencycarrytrade.asp Value?  The value of this investment depend on the currency being used. Since most high interest currency belong to third world countries, their currency tend to be very unstable. For example Argentina which have an interest rate of 8.18%(at the time of this post) but due to it the 2014 Aug Default, no sane investor would consider getting this bond. If the trader get the safer developed countries currency, the interest rate tend to be lower. So in order to get the same return as third world countries, the trader would need to leve...