Re: formating string output?

From: Jerold Schulman (Jerry_at_jsiinc.com)
Date: 04/22/04


Date: Thu, 22 Apr 2004 15:10:24 -0400

On Thu, 22 Apr 2004 14:28:36 -0400, "djc" <noone@nowhere.com> wrote:

>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



Relevant Pages

  • Re: tapes wont format
    ... >will format and some won't. ... >looking for speculation. ... Windows: General MVP ...
    (microsoft.public.win2000.general)
  • Re: Reformat C when XP is already installed
    ... You can do a repair or reinstall.".. ... >> know that many try to format from the Command Prompt in Windows XP.. ... I don't know where this "there is no reboot in my ...
    (microsoft.public.windowsxp.hardware)
  • Re: reformat
    ... before you format the hard drive and return it to the ... create a standard partition and then format with FAT 32 or if the drive is ... After installing Windows XP, ...
    (microsoft.public.windowsxp.general)
  • Re: WMI Date works on XP but not 2000 Server
    ... > use does not exist in the earlier implementation of WMI. ... > Microsoft MVP (Windows Security) ... > format designed by the Distributed Management Task Force. ... > occurring in the current year, time, day, and/or time zone. ...
    (microsoft.public.windows.server.security)
  • Re: Unable to delete
    ... I'd remove the partition, not just format it, then create a new one from the ... Windows help - www.rickrogers.org ... AND to the Command prompt. ... exist on the main drives. ...
    (microsoft.public.windowsxp.basics)

Loading