Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Hi, i'm having a log file wherein i need to pick up only few values/text from the matched string lines and put into another file. I'm 50% done with that. i used "FIND" command to find the matched string lines & also used ">" command to put into another file.
like FIND /I "str" log.txt > newfile.txtThe output of this command is picking up the entire line of the matched string from the log file & put into another file.
BUT,
My requirement is : need to copy only few text in the matched line & placed it into another file.
Let say for eg: log.txt containsmap1 records read: 100
map1 records written: 200
map1 records error: 0
map2 records read: 1234
map2 records written: 123
map2 records error: 2
.
.
.From this log file, i need to go for search based on map name (map1,map2 etc..) and want pick up only the count of records read, written ,Error values into another file. ONLY the count values.
If i take up map1 as string then i need to put only 100,200, 0 into new file.
In unix, i know the solun, we can go for grep & cut command but i dont know how it can be done via windows batch process.can anyone help me whats the command to CUT some text in a line using batch process?

with batch you can use tokens and delim with the for loop. else, you can use vbscript. read the file line by line and do a split on each line. Use Instr to check if your word in in the line.
Last but not least, if you can download unix tools for windows(see my sig), you can use the regular grep/cut as well.

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |