I take the occasion to greet you and thank you for your help ..forgive my English but I write from Italy
I have a list of servers in a .txt file must modify it by adding thiss 127.0.0.1 before each server, including a space between 127.0.0.1 and the server name
I would need to enter in a text file that contains a list of servers written vertically, I have to create a file that allows me to enter 127.0.0.1 in front of each server but 'keeping a space between 127.0.0.1 and the server name, example:
171.24.24.48
172.89.89.24
must 'become so in the file text
127.0.0.1 171.24.24.48
127.0.0.1 172.89.89.24
Add an IP address to the start of every line in a text file
Moderator: DosItHelp
Re: please i need your aid
good morning this a worked
essentially.. takes the contents of the file2 and writes it in the file1 and adding 127.0.0.1 before each line; I found online and I changed something for me, I unfortunately do not know the programming, however, is very rewarding
Code: Select all
@ECHO OFF
SET "NomeFile_sorgente=file1.txt"
SET "NomeFile_Destinazione=C:\Users\percorso\Documents\file2.txt"
ECHO. > %NomeFile_Destinazione%
FOR /F "delims=" %%a IN (%NomeFile_sorgente%) DO ECHO 127.0.0.1 %%a >> %NomeFile_Destinazione%
PAUSE
essentially.. takes the contents of the file2 and writes it in the file1 and adding 127.0.0.1 before each line; I found online and I changed something for me, I unfortunately do not know the programming, however, is very rewarding
Re: please i need your aid
Code: Select all
@echo off
if exist output.txt del output.txt
for /f %%f in (input.txt) do >>output.txt (echo 127.0.0.1 %%f)
HTH.
Saso
Re: please i need your aid
miskox Thank you very much , I love this language, if you have a good free book for beginners, you can send me the link ? thanks, I would like to learn