0

There is always a single double quote at the end of a text file...

"1","abc","123"
"2","abcd","456"
"3","abce","789"
"

I need a command to run via cmd.exe to delete the last line (the single double quote) only...

"1","abc","123"
"2","abcd","456"
"3","abce","789"
Srini
  • 489
  • 1
  • 11
  • 25
Ian Carrick
  • 242
  • 3
  • 18

1 Answers1

0

extended my previous answer:

@echo off
copy t.txt old.txt
<nul >"new.txt" set /p x="""
>>"new.txt" (type "old.txt" |findstr /v "^.$")
rem move /y "old.txt" "new.txt"
type new.txt

The additional findstr /v excludes lines with a single character (it's quite difficult to work with a ", but I guess, a "single character line" is good enough)

Stephan
  • 53,940
  • 10
  • 58
  • 91