How do I delete the last line of a text file using the echo command in windows?
views:
305answers:
2
+3
A:
Echo only has 2 uses:
ECHO [ON | OFF]
ECHO [message]
You can overwrite a file completely using a redirect
ECHO Testing > a.txt
Or you can append to a file using an append redirect
ECHO Testing >> a.txt
Or you can write a new line
ECHO.
But you can't use it to remove the last line
Brian R. Bondy
2009-04-02 14:43:22
A:
Have a look for a 'tail' command/equivalent (plenty on google depending on OS version).
then
copy oldfile tempfile
tail -1 > oldfile
Regards Michael.
Michael
2009-04-02 14:52:48