Hello! I currently need some help with a batch code that would delete the first and last line of a text file. I already have a batch thats joins 3 files together into a new text file. It does something like this:
Copy file 1
Copy file 2
Copy file 3
Create text file "data"
Delete file 1 2 and 3.The batch file I need would need to erase data.txt's first and last lines and save it to a new
Text file named "assembly.txt" Any help would be gladly appreciated!-Dice
Hi ghost. I downloaded sed, and used the code you provided. I really appreciate your help, but the code only exports a blank file named "sed" in .file format, while my other file still has it's lines. I've been experimenting with this code:
@echo off & setlocal EnableDelayedExpansion > file2.txt
set /P row=< file.txt
for /F "skip=1 delims=" %%j in (file2.cfg) do (
set row=%%j
echo.!row!>> file2.txt
)It manages to work great, and exports the file into the extension I need. The only problem is, it deletes every line of text that contains either ! ; and "
I don't really mind it deleting the lines with ; and " since that's what I exactly want out of the text file, but what bugs me is it deletes the ! character out of every line. Do you have any idea on why this is happening?
by default sed does not edit your file. you have to pipe to a temp file and rename it back to make the changes, or you can use the -i flag c:\test> sed -i.ext -n "2,${$d;p}" filethis says edit the file in place, and save it as extension .ext.
Yes (14) | ![]() | |
No (14) | ![]() | |
I don't know (15) | ![]() |