Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to remove a character in a file

Status
Not open for further replies.

morijona

IS-IT--Management
Nov 6, 2003
10
0
0
CA
i wanna know how i can remove a character in a file i mean i wanna delete the first 2 character of each line.

There is my script i wanna do a list of all pc and server of my network with their IP adress

NET VIEW > H:\Script\ordis.txt
FIND "\\" H:\Script\ordis.txt > H:\Script\collecte\POSTES_TMP.TXT
IF EXIST H:\Script\collecte\POSTES.TXT DEL H:\Script\collecte\POSTES.TXT
FOR /F "eol=-" %%i IN (H:\Script\collecte\POSTES_TMP.TXT) DO ECHO %%i >> H:\Script\collecte\POSTES.TXT
pause
FOR /F "eol=-" %%i IN (H:\Script\collecte\POSTES.TXT) DO ping %%i >>h:\script\collecte\liste_ip_TMP.txt
pause
FOR /F "eol=-" %%i IN (H:\Script\collecte\Liste_ip_tmp.TXT) DO
FIND "192.9.200" H:\Script\collecte\liste_ip_tmp.txt > H:\Script\collecte\liste_ip.TXT

Thanks
Jonathan Morin
Network administrator
Garant Inc.
 
Hi Jonathan,
It looks like a batch file... here goes

for /f "skip=3" %%i in ('NET VIEW ^| find "The" /V') do echo %%i >> H:\Script\ordis.txt

IF EXIST H:\Script\collecte\POSTES.TXT DEL H:\Script\collecte\POSTES.TXT

***********************************
:: This is the part youre insterested in ::
for /f %%i in (H:\Scripts\ordis.txt) do call :DOIT %%i
goto :CONTINUE
:DOIT
set pc=%1
set pc=%pc:~2,15%
echo %pc% >> H:\Script\collecte\POSTES.TXT
:END
************************************
Continue your script here..........
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top