Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Output data to certain character field

Status
Not open for further replies.

jestrada101

Technical User
Mar 28, 2003
332
Is there a method to write data to a file to a certain character location?
 
What exactly are you trying to do? There may be easier alternatives.

Sean.
psa.gif
 
I'm trying to write data to a log file... and I want it to start at a certain position...

Example..

12:00:35 Informatio Here DONE.
12:00:35 More Information Herer DONE.

I want information to be lined up... particularly teh "DONE." I tried using the "\t", but it wouldn't align the way I needed it to.

Thanks for any guidance..

JE
 
What command do you use to write to the file ? echo, awk, another...
which Shell use?

Jean Pierre.
 
Korn shell... using the: print "Done." >> LOGFILE

Thanks.
 
For example, if you xant to write "Done" on column 42, you can do :

printf "%-40s " "12:00:35 More Information Here" >> LOGFILE
print "Done." >> LOGFILE

or

typeset -L40 txt
txt="12:00:35 More Information Here"
print -n "$txt" >> LOGFILE
print " Done." >> LOGFILE

Jean Pierre.
 
Where is the information here coming from?

--
| Mike Nixon
| Unix Admin
|
----------------------------
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top