Re: formating string output?
From: Jerold Schulman (Jerry_at_jsiinc.com)
Date: 04/22/04
- Next message: Jerold Schulman: "Re: Schtasks.exe (Settings)"
- Previous message: Matthias Tacke: "Re: Closing notepad.exe from the command line"
- In reply to: djc: "formating string output?"
- Next in thread: djc: "Re: formating string output?"
- Reply: djc: "Re: formating string output?"
- Messages sorted by: [ date ] [ thread ]
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
- Next message: Jerold Schulman: "Re: Schtasks.exe (Settings)"
- Previous message: Matthias Tacke: "Re: Closing notepad.exe from the command line"
- In reply to: djc: "formating string output?"
- Next in thread: djc: "Re: formating string output?"
- Reply: djc: "Re: formating string output?"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|