Pad unequal length lines with spaces to make all the same.
Posted: 17 Jun 2011 11:32
Not having a full grasp of all the commands available, for all I know there might be a command that will do this properly.
Bearing in mind that the line being read in is less than 80 characters, what I have done is read in the short line and write it to the output file defined as a longer line, like this:
set "line=!line:~0,80!"
echo !line!>>outfile.txt
This works in my case, but it somehow seems to leave the possibility of garbage being caught up and written to the file in the additional spaces when I extend the length of the line.
Is this okay, or is there a better way to do it?
Possibly this to ensure no garbage gets picked up?
set "line=!line! " EDIT: the forum editor trimmed this down to one space. I had 80 there.
echo !line:~0,80!>>outfile.txt
Bearing in mind that the line being read in is less than 80 characters, what I have done is read in the short line and write it to the output file defined as a longer line, like this:
set "line=!line:~0,80!"
echo !line!>>outfile.txt
This works in my case, but it somehow seems to leave the possibility of garbage being caught up and written to the file in the additional spaces when I extend the length of the line.
Is this okay, or is there a better way to do it?
Possibly this to ensure no garbage gets picked up?
set "line=!line! " EDIT: the forum editor trimmed this down to one space. I had 80 there.
echo !line:~0,80!>>outfile.txt