formating string output?

  • Thread starter Thread starter djc
  • Start date Start date
D

djc

I have a batch file that appends to a log file. I use the find command a lot
on this file to check things out. What I would like to do is format the
output to make is look nicer. For example the text file has several fields
delimited with a comma. I would like to show field headings and evenly space
the output into nice columns.

whats the best way to go about doing this?

thanks.
 
djc said:
I have a batch file that appends to a log file. I use the find command a lot
on this file to check things out. What I would like to do is format the
output to make is look nicer. For example the text file has several fields
delimited with a comma. I would like to show field headings and evenly space
the output into nice columns.

whats the best way to go about doing this?

thanks.
Have a look at timo's cmdfaq. There are several related topics.
Some grew out of threads here, so read here or search via google:
http://groups.google.com/groups?group=alt.msdos.batch.nt&q=justify

HTH
 
I have a batch file that appends to a log file. I use the find command a lot
on this file to check things out. What I would like to do is format the
output to make is look nicer. For example the text file has several fields
delimited with a comma. I would like to show field headings and evenly space
the output into nice columns.

whats the best way to go about doing this?

thanks.


If you were starting fresh, and you have 3 fields call

field One max length 40
field two max length 30
field three max length 50

set fh1=Field One
set fh1=%fh1:~0,40%,
set fh2=Filed Two
set fh2=%fh2:~0,30%,
set fh3=Filed Three
set fh3=%fh3:~0,50%
if not exist logfile.log @echo %fh1%%fh2%%fh3%>logfile.log

.....
.....
set f1=%var1:~0,40%,
set f2=%var2:~0,30%,
set f3=%var3:~0,50%
@echo %f1%%f2%%f3%>>logfile.log
go to ....




Jerold Schulman
Windows: General MVP
JSI, Inc.
http://www.jsiinc.com
 
Thanks

Jerold Schulman said:
If you were starting fresh, and you have 3 fields call

field One max length 40
field two max length 30
field three max length 50

set fh1=Field One
set fh1=%fh1:~0,40%,
set fh2=Filed Two
set fh2=%fh2:~0,30%,
set fh3=Filed Three
set fh3=%fh3:~0,50%
if not exist logfile.log @echo %fh1%%fh2%%fh3%>logfile.log

....
....
set f1=%var1:~0,40%,
set f2=%var2:~0,30%,
set f3=%var3:~0,50%
@echo %f1%%f2%%f3%>>logfile.log
go to ....




Jerold Schulman
Windows: General MVP
JSI, Inc.
http://www.jsiinc.com
 
Back
Top