fit2width

Package: WA2L/edrc 1.5.57
Section: Library Commands (3)
Updated: 04 April 2009
Index Return to Main Contents

 

NAME

fit2width - fit a stream to a with

 

SYNOPSIS

edrc/lib/fit2width [ -h | -m ] [ width ]

edrc/lib/fit [ -h | -m ] [ width ]

 

AVAILABILITY

WA2L/edrc

 

DESCRIPTION

fit a data stream to a specified width.

This command can be used together with tty_columns(3) to fit a stream to the current width of a terminal (tty).

 

OPTIONS

-h
print usage message.

-m
mark lines that are longer as the specified width with '>>' at the end of the line.
If this option is not specified, the lines are shortened to the given width without marking it.

width
number of characters to be printed. If this option is not set, the default width is resolved by tty_columns(3) if it is a tty. If it is not a tty the contents of the $COLUMNS environment variable is used as a default.

 

ENVIRONMENT

-

 

EXIT STATUS

0
no error.

4
usage message printed.

 

FILES

-

 

EXAMPLES

1) fit the /etc/services file to the screen width using tty_columns

[ / ]
[ root@acme007 ][-sh]: cat /etc/services |\
                         fit2width -m `tty_columns`

#
# /etc/services: - Network services, Internet Style
#
# Each line describes one service, and is of the for >>
#
# service-name  port/protocol  [aliases ...]   [# co >>

tcpmux          1/tcp                           # TC >>
tcpmux          1/udp                           # TC >>
rje             5/tcp                           # Re >>
:
:

2) fit the /etc/services file to the screen width using default width

[ / ]
[ root@acme007 ][-sh]: cat /etc/services |\
                         fit2width -m

#
# /etc/services: - Network services, Internet Style
#
# Each line describes one service, and is of the for >>
#
# service-name  port/protocol  [aliases ...]   [# co >>

tcpmux          1/tcp                           # TC >>
tcpmux          1/udp                           # TC >>
rje             5/tcp                           # Re >>
:
:

3) fit the /etc/services file to a width of 55 characters

[ / ]
[ root@acme007 ][-sh]: cat /etc/services |\
                         fit2width -m 55

#
# /etc/services: - Network services, Internet Style
#
# Each line describes one service, and is of the for >>
#
# service-name  port/protocol  [aliases ...]   [# co >>

tcpmux          1/tcp                           # TC >>
tcpmux          1/udp                           # TC >>
rje             5/tcp                           # Re >>
:
:

 

SEE ALSO

edrcintro(1), tty_columns(3)

 

NOTES

-

 

BUGS

-

 

AUTHOR

fit2width was developed by Christian Walther. Send suggestions and bug reports to wa2l@users.sourceforge.net . 

 

COPYRIGHT

Copyright © 2009 Christian Walther

This is free software; see edrc/doc/COPYING for copying conditions. There is ABSOLUTELY NO WARRANTY; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


 

Index

NAME
SYNOPSIS
AVAILABILITY
DESCRIPTION
OPTIONS
ENVIRONMENT
EXIT STATUS
FILES
EXAMPLES
SEE ALSO
NOTES
BUGS
AUTHOR
COPYRIGHT

This document was created by man2html using the manual pages.
Time: 16:53:01 GMT, August 28, 2024