Computing.Net > Forums > Programming > Batch: Delete lines in txt / extrac

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Batch: Delete lines in txt / extrac

Reply to Message Icon

Name: xs
Date: January 25, 2008 at 06:11:55 Pacific
OS: XP
CPU/Ram: Intel 1G
Product: OEM
Comment:

Hi all!

In this batch file:

:: multiIP.bat
@echo on

for /f "tokens=*" %%I in (c:\tmp\IPlist) do call :pinger %%I
goto :eof

:pinger

ping -a %1 >> pingLOG
:: DONE

I would like to extract the result of the line containing the hostname and the IP in IPlist.
These two results would be inserted in a new log file.

I managed with:

:: getinfo.bat
@ECHO ON

for /f "skip=1 tokens=2,3" %%i in (pingLOG) do @echo %%i %%j >> result.txt

start notepad.exe result.txt

:: Pause for 5 sec
ping -n 5 localhost > NUL

del result.txt
:: DONE

to "extract" the two actual tokens but I do not need the lines after those in result.txt

Could anyone give me some idea, help?

Thanks!
Erik

What?



Sponsored Link
Ads by Google

Response Number 1
Name: Mechanix2Go
Date: January 25, 2008 at 06:46:12 Pacific
Reply:

for /f " tokens=2,3" %%i in ('find "Pinging" ^< pingLOG') do (
echo %%i %%j >> result.txt
)



=====================================
If at first you don't succeed, you're about average.

M2



0
Reply to Message Icon

Related Posts

See More







Post Locked

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


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: Batch: Delete lines in txt / extrac

Batch deletion based on .txt file on ftp www.computing.net/answers/programming/batch-deletion-based-on-txt-file-on-ftp/20025.html

Batch to del specific lines in txt www.computing.net/answers/programming/batch-to-del-specific-lines-in-txt/13482.html

batch edit specific line in txt www.computing.net/answers/programming/batch-edit-specific-line-in-txt/16778.html