Jump to content

Welcome to MSFN Forum
Register now to gain access to all of our features. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more. This message will be removed once you have signed in.
Login to Account Create an Account



Photo

How delete text line by Command prompt

- - - - -

  • Please log in to reply
3 replies to this topic

#1
kali

kali

    KamrulCox

  • Member
  • Pip
  • 96 posts
  • Joined 17-April 11
  • OS:Windows 8.1 x64
  • Country: Country Flag
I can make text file with command prompt and also add text to a file. But how to delete text line from text file I don't know. Is there any way to delete text line with DOS.


How to remove advertisement from MSFN

#2
allen2

allen2

    Not really Newbie

  • Member
  • PipPipPipPipPipPipPip
  • 1,814 posts
  • Joined 13-January 06
Solution there.

#3
jaclaz

jaclaz

    The Finder

  • Developer
  • 14,689 posts
  • Joined 23-July 04
  • OS:none specified
  • Country: Country Flag

I can make text file with command prompt and also add text to a file. But how to delete text line from text file I don't know. Is there any way to delete text line with DOS.

Yes/No.
Meaning that it is possible NOT to delete a line of text from a "plain txt" file, but it is possible to re-create the text file excluding a given line.
There are two basic approaches, using FIND or FINDSTR (possibly with the /V parameter) to filter out some specific content or use MORE and FOR loops with ECHO (but you might need a batch file).
There might be issues with "unicode" and with "special characters"including leading spaces, though.


JFYI, there is NO real "DOS" in XP, there is it's Command Prompt (which uses a different command processor cmd.exe, than the actual DOS command processor command.com).
It's similar, but not exactly the same.

In any case the "default" programs are "limited", and you might find more useful adding a third party tool, like SED, see also this:
http://www.msfn.org/...rm-a-text-file/

jaclaz

P.S.: Oops, cross-posting with allen2 :blushing:

Edited by jaclaz, 09 July 2013 - 12:12 PM.


#4
kali

kali

    KamrulCox

  • Member
  • Pip
  • 96 posts
  • Joined 17-April 11
  • OS:Windows 8.1 x64
  • Country: Country Flag

Meaning that it is possible NOT to delete a line of text from a "plain txt" file, but it is possible to re-create the text file excluding a given line.
There are two basic approaches, using FIND or FINDSTR (possibly with the /V parameter) to filter out some specific content or use MORE and FOR loops with ECHO (but you might need a batch file).
There might be issues with "unicode" and with "special characters"including leading spaces, though.


Thanks jaclaz.
I found same informations in online searching you wrote above. I'll follow your re-create text file. Thanks alos allen2.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users