ECHOing to a file without a trailing space
Posted: 10 Nov 2023 11:27
Hello all!
Results:
file1.tmp and file2.tmp are empty because "2" redirects it.
file3.tmp (size 9 bytes - trailing space after number 2)
file4.tmp (size 19 bytes)
You see that
is no good because my data can contain round brackets ().
I don't need a space at the end of the line.
I need:
(numbers 2 and are just to show different behavior. There is only one number at the end of the file)
Please help.
Thanks.
Saso
Code: Select all
@echo off
set field1=a
set field2=(a
set field3=2
set field4=34564119
echo %field1%;%field2%;%field3%>file1.tmp
echo %field1%;%field2%;%field3%>file2.tmp
echo %field1%;%field2%;%field3% >file3.tmp
echo (%field1%;%field2%;%field3%;%field4%)>file4.tmp
file1.tmp and file2.tmp are empty because "2" redirects it.
file3.tmp (size 9 bytes - trailing space after number 2)
Code: Select all
a;(a;2
Code: Select all
(a;(a;2;34564119)
Code: Select all
>>file.tmp (echo...)
I don't need a space at the end of the line.
I need:
Code: Select all
a;(a;2
Please help.
Thanks.
Saso