Skip to main content

hi all need a lil help with batch files

More
18 years 4 months ago #15542 by Starfire
Also, if you need to do any further text pre-processing on the netsat output before you place it into the text file you can use windows versions of handy unix tools like 'grep32' .(shareware/freeware?)

For instance, if there are only certain parts of the netstat output you are interested in, you can work out the grep switches to only look for that line in the output and just send that to the text file without all the unwanted stuff.

ie. netstat -e | grep32 "Bytes"

(notice the 'pipe' = '|' the vertical bar key on all keyboards)
Produces this output only

Bytes 28941198 15506957

You can then send that output to your text file...

ie. netstat -e | grep32 "Bytes" >> text.txt

You can either have an icon setup to point to the text.txt file or have your program upload it's data from that file... whatever it is you are doing.

Just make sure where you place the grep, awk, sed, etc is in the path statement for the dos window or that you run your netstats from the directory they are located.

Unix has some very powerful text processing commands and the windows versions of them can be just as powerfull if harnessed properly.

For a deeper explanation on the power of grep see - pegasus.rutgers.edu/~elflord/unix/grep.html

Windows/Dos versions of these great Unix commands (grep/awk/sed/perl) can be found here - www.ibiblio.org/pub/micro/pc-stuff/freedos/gnuish/

They take a bit of getting used to but the rewards are worth it.
More
18 years 4 months ago #15669 by Alans
Hi...
i'm a lil new to these subjects, i don't know why @ is used before echo?? can any one give any link for commands that used in batch files, any information i'll be thankfull..

always Face your Fears...
More
18 years 4 months ago #15672 by DaLight
Check out this link and this link . The "@" is typically used before the "echo off" command if you do not want to echo the echo command.
More
18 years 3 months ago #15765 by TheBishop
Replied by TheBishop on topic Batch Files
Excellent links bro
Time to create page: 0.126 seconds