The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Special Forums > Windows & DOS: Issues & Discussions
Google UNIX.COM


Windows & DOS: Issues & Discussions Questions involving Unix to Windows (Desktop or Server) go here. Any Windows/DOS questions should go here as well.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Replace word in a file sasiharitha UNIX for Dummies Questions & Answers 3 12-04-2007 09:11 PM
replace word in a file ust Shell Programming and Scripting 5 11-30-2007 04:03 PM
Replace word. abu_hassan SUN Solaris 2 03-04-2007 01:14 PM
how to replace a word with another rkrgarlapati Shell Programming and Scripting 1 07-24-2006 04:42 AM
How to replace a word with a series of words in a file brap45 Shell Programming and Scripting 2 02-20-2006 10:33 PM

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 04-23-2008
Registered User
 

Join Date: Apr 2008
Posts: 1
how do I replace a word in a file using DOS commands??

how do I replace a word in a file using DOS commands??
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 05-21-2008
Registered User
 

Join Date: Dec 2007
Location: Wilton, CA
Posts: 5
Just go into the editor (edit.com) and change whatever. I have never seen any version of DOS (except maybe the really old ones) that do not have EDIT.COM among all the normal files like the command interpreter. From what I am aware there isn't an actual command besides edit.com that will do any kind of file editing of that sort in DOS or Windows.

To use EDIT.COM in DOS

1) Go to the directory with EDIT.COM in it (usually in the root of the C: drive or in C:\DOS\ or some similar directory)

2) Type "EDIT $FILEPATH" (excluding the quotation marks of course), where $FILEPATH is the path to the file you wish to edit (example: "EDIT A:\HOMEWORK.TXT" excluding the quotes)

3) In the MS-DOS Editor, navigate to the word you wish to replace, highlight it, and type a new word in. Then, click on File > Save and then File > Exit (or, if you don't have a mouse, use Alt + S then Alt + X)

4) Your file is now edited.

Note that this does not work for formatted documents (.rtf, .doc, etc.) and I don't know if this works for documents created with VIM or other UNIX editors; if it's plain text, this method will work.
Reply With Quote
Google UNIX.COM
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 09:30 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0