dos


[ Follow Ups ] [ Post Followup ] [ The EasyDOS Forum ] [ FAQ ]

Posted by roggerpt on September 30, 2011 at 11:58:55:

Dos - Hi,

I want to open a file want to replace a line in the file with a diffrent line, but i dont want to search with full line in the file instead i will give only
a part of the line and the program should replace the whole line with given line.

For Example:- In makfi.txt file i have a line like this --the current user logged in is ruddet--, now i want to use only "the current user logged" word from
this line for my search and i want replace the whole line with a diffrent line.

I have writen below program for my requirement, but it is replacing only a signle word, When i tried with line it not working.

Could some one please help.


@echo off
SETLOCAL=ENABLEDELAYEDEXPANSION
for /f %%a in (makfi.txt) do (
set foo=%%a
if !foo!==ex3 set foo=ex5
echo !foo! >> text.file)


Follow Ups:



Post a Followup (use TAB key to move between boxes - NOT ENTER or RETURN)

Name:
E-Mail:

Subject:

Type your comments in the box below and SUBMIT:


[ Follow Ups ] [ Post Followup ] [ The EasyDOS Forum ] [ FAQ ]