This is my input file content which I am using to copy to the output file.
#sdfs|dfasf|sdfs|
sdfs|df!@$%%*&!sdffs|
sasdfasfa|dfsdf|#sdfs|
What I need to do is to omit the first character '#' and last character '|' in the output file. So the output will be,
sdfs|dfasf|sdfs|
sdfs|df!@$%%*&!sdffs|
sasdfasfa|dfsdf|#sdfs
Batch script is new to me, but I tried my best and tried these codes,
:: drop first and last char
@echo off > xyz.txt & setLocal EnableDelayedExpansion
for /f "tokens=* delims=" %%a in (E:\abc1.txt) do (
set str=%%a
set str=!str:~1!
echo !str!>> xyz.txt
)
As you can see it is not able to produce the required output.
The output now being produced is like
sdfs|dfasf|sdfs|
dfs|dfsdffs|
asdfasfa|dfsdf|#sdfs|
I don't know why the string !@$%%*&!
is also getting ripped !?