home hardware prices news articles forums photos user reviews
Go Back   Tech Support Forums - TechIMO.com > PC Hardware and Tech > Webmastering and Programming
Join TechIMO for Free!
Register Blogs FAQ Members List Calendar Search Today's Posts Mark Forums Read
Reply Get bargains at  »  Dealighted.com
 
Thread Tools
Currently Active Users: 2727
Discussions: 186,607, Posts: 2,227,060, Members: 230,243
Free Scan: Update Your PC's Outdated Drivers to Optimize Performance
Old February 28th, 2002, 04:10 AM   Digg it!   #1 (permalink)
Banned
 
Chooco's Avatar
 
Join Date: Feb 2002
Posts: 804
tally up frequency of a string and write it to a file...?

i run a Counter-Strike server with a thing called CSguard. it bans people quite often for using very common hacks such as HLH (Half Life Hacked) or OGC. what i want to do is write a script to open the certain file (just 1 file) and detect how often the string "ogc" and "HLH" appear then write that to a file such as
&ogc OGC hackers total
&hlh HLH hackers total

i'm only up to like chapter 6 of C++ for dummies so i don't know the commands lol.

all i need to know is the command to detect a string in a specified file and how to make C++ write a file with the results

Chooco is offline   Reply With Quote
TechIMO.com Ads - Login or register for less ads.
How many errors does your computer have?

You no longer need to guess! This free stability scan and registry cleaner download will give you a complete diagnosis of your Windows registry, identifying errors and conflicts.

FREE instant scan


Guest, Register Free! to remove this ad and get your tech support questions answered in minutes!
Old February 28th, 2002, 05:57 AM     #2 (permalink)
Ultimate Member
 
strangerstill's Avatar
 
Join Date: Oct 2001
Posts: 1,542
You can do this in DOS quite easily

Just write a batch file

find /c /i "OGC" < CSguard.log > hacklog.txt
echo OGC hackers total >> hacklog.txt
find /c /i "HLH" < CSguard.log >> hacklog.txt
echo HLH hackers total >> hacklog.txt

Only problem is output file will have nasty line breaks. Not sure how to get round that one...

strangerstill is offline   Reply With Quote
Old February 28th, 2002, 06:21 AM     #3 (permalink)
Banned
 
Chooco's Avatar
 
Join Date: Feb 2002
Posts: 804
what do the /c and /i mean?
what exactly is a batch file anyway. is it compiled by anything?

*edit*
OMG THAT IS SO COOL!!! a batch file doesn't need to be compiled? no way! lol
excellent program man, thanks


Last edited by Chooco : February 28th, 2002 at 06:29 AM.
Chooco is offline   Reply With Quote
Old February 28th, 2002, 06:32 AM     #4 (permalink)
Ultimate Member
 
strangerstill's Avatar
 
Join Date: Oct 2001
Posts: 1,542
Hmm. Are you running XP Professional? If so running hh ntcmds.chm will bring up the helpfile on the XP command line.

Otherwise, a batch file is a text file with the extension .bat that consists of a series of DOS commands on subsequent lines. DOS reads the batch file and executes each line in turn as if it was typed in at the command prompt. There's slightly more to it than that - some basic flow control and variable support, like a script file. Batch files have been part of DOS since the early days, recently they have been somewhat superceded by the Windows Scripting Host (VBScript/JScript) but batch files still remain the easiest way to quickly automate simple tasks.

As for the switches on find, /c means to just count the number of occurences (rather than outputting every single line that the search string appears in), /i means that it the search is case insensitive. Type find /? at the command prompt for more.

Here's what Microsoft say about batch files:
Quote:
Using batch files

With batch files, which are also called batch programs or scripts, you can simplify routine or repetitive tasks. A batch file is an unformatted text file that contains one or more commands and has a .bat or .cmd file name extension. When you type the file name at the command prompt, Cmd.exe runs the commands sequentially as they appear in the file.

You can include any command in a batch file. Certain commands, such as for, goto, and if, enable you to do conditional processing of the commands in the batch file. For example, the if command carries out a command based on the results of a condition. Other commands allow you to control input and output and call other batch files.
strangerstill is offline   Reply With Quote
Old February 28th, 2002, 06:35 AM     #5 (permalink)
Banned
 
Chooco's Avatar
 
Join Date: Feb 2002
Posts: 804
so a batch file is like a plugin for DOS. the real program is like batch.exe or something and the plugin would be hacklog.bat...........interesting
Chooco is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may post new threads
You may post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Most Active Discussions
Is It Just Me? (532)
Misery Loves Company... (1849)
Why Does the MOON Grow Bigger as It.. (18)
heatsink issue (10)
New Mobo (18)
UPGRADING C/D DRIVE TO 250GB & .. (14)
1 internet. 1 house. 3 computer. ho.. (13)
SSD's, RAID, and External Backup (7)
Is This A Compatible Gaming PC? (18)
Recent Discussions
Building my first PC and need s.. (2)
32 or 64 bit vista (4)
Big problem with my PC (2)
system restore 'next' button wo.. (2)
firewall (1)
C++ compiler suggestions (4)
Official World of Warcraft Thre.. (4529)
Programming question (2)
UPGRADING C/D DRIVE TO 250GB &a.. (14)
FS: Dell 6000 laptop, modded 36.. (2)
Apple iPod touch 16 GB $200 (4)
Six 28-Disc Cross Design Black .. (4)


All times are GMT -4. The time now is 12:27 PM.
TechIMO Copyright 2008 All Enthusiast, Inc.



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28