помогите с выравниванием текста.
кусок кода
echo -e "N/N\t\tRBS\t\t\t\t\tRNC"
echo -e "vp1\t\t$vp1\t\t$descrVP1"
echo -e "vc32\t\t$vc32\t\t$descrVC32"
echo -e "vc36\t\t$vc36\t\t$descrVC36"
echo -e "vc37\t\t$vc37\t\t$descrVC37"
echo -e "vc38\t\t$vc38\t\t$descrVC38"
echo -e "vc39\t\t$vc39\t\t$descrVC39"
echo -e "vc40\t\t$vc40\t\t$descrVC40"
то что происходит
N/N RBS RNC
vp1 AtmTrafficDescriptor=C1P8800 AtmTrafficDescriptor=C1P8800
vc32 AtmTrafficDescriptor=U3M20 AtmTrafficDescriptor=U3M20
vc36 AtmTrafficDescriptor=U3P1000M160 AtmTrafficDescriptor=U3P1000M160
vc37 AtmTrafficDescriptor=U3P1000M160 AtmTrafficDescriptor=U3P1000M160
vc38 AtmTrafficDescriptor=U3P1000M160 AtmTrafficDescriptor=U3P1000M160
vc39 AtmTrafficDescriptor=C2P6500 AtmTrafficDescriptor=C2P6500
vc40 AtmTrafficDescriptor=U42 AtmTrafficDescriptor=U42
в качестве костыля можно конечно уменьшить количество \t
но энто не выход. если дескрипторы будут другими то опять получится пляска текста.
спасбо
выравнивание
"man column"
COLUMN(1) User Commands COLUMN(1)
NAME
column - columnate lists
SYNOPSIS
column [options] file...
DESCRIPTION
The column utility formats its input into multiple columns. Rows are filled before columns. Input is taken from file or, by
default, from standard input. Empty lines are ignored.
OPTIONS
-c, --columns width
Output is formatted to a width specified as number of characters.
-t, --table
Determine the number of columns the input contains and create a table. Columns are delimited with whitespace, by default,
or with the characters supplied using the separator. Table output is useful for pretty-printing.
-s, --separator separator
Specify table separator (default is whitespace).
-x, --fillrows
Fill columns before filling rows.
-h, --help
Print help and exit.
ENVIRONMENT
The environment variable COLUMNS is used to determine the size of the screen if no other information is available.
EXAMPLES
sed 's/#.*//' /etc/fstab | column -t
SEE ALSO
colrm(1), ls(1), paste(1), sort(1)
HISTORY
The column command appeared in 4.3BSD-Reno.
AVAILABILITY
The column command is part of the util-linux package and is available from ftp://ftp.kernel.org/pub/linux/utils/util-linux/.
util-linux October 2010 COLUMN(1)
"Как пример"
lupo@gentoo-laptop ~ % which nicemount
nicemount () {
(
echo "DEVICE PATH TYPE FLAGS" && mount | awk '$2=$4="";1'
) | column -t
}
lupo@gentoo-laptop ~ % nicemount
DEVICE PATH TYPE FLAGS
rootfs / rootfs (rw)
devtmpfs /dev devtmpfs (rw,nosuid,relatime,size=10240k,nr_inodes=219828,mode=755)
/dev/mapper/vg-root / ext4 (rw,noatime,nodiratime,commit=0)
proc /proc proc (rw,nosuid,nodev,noexec,relatime)
tmpfs /run tmpfs (rw,nosuid,nodev,relatime,mode=755)
sysfs /sys sysfs (rw,nosuid,nodev,noexec,relatime)
cgroup_root /sys/fs/cgroup tmpfs (rw,nosuid,nodev,noexec,relatime,size=10240k,mode=755)
openrc /sys/fs/cgroup/openrc cgroup (rw,nosuid,nodev,noexec,relatime,release_agent=/lib/rc/sh/cgroup-release-agent.sh,name=openrc)
cpuset /sys/fs/cgroup/cpuset cgroup (rw,nosuid,nodev,noexec,relatime,cpuset)
cpu /sys/fs/cgroup/cpu cgroup (rw,nosuid,nodev,noexec,relatime,cpu)
cpuacct /sys/fs/cgroup/cpuacct cgroup (rw,nosuid,nodev,noexec,relatime,cpuacct)
devices /sys/fs/cgroup/devices cgroup (rw,nosuid,nodev,noexec,relatime,devices)
freezer /sys/fs/cgroup/freezer cgroup (rw,nosuid,nodev,noexec,relatime,freezer)
perf_event /sys/fs/cgroup/perf_event cgroup (rw,nosuid,nodev,noexec,relatime,perf_event)
devpts /dev/pts devpts (rw,nosuid,noexec,relatime,gid=5,mode=620)
none /dev/shm tmpfs (rw,nosuid,nodev,noexec,relatime)
fusectl /sys/fs/fuse/connections fusectl (rw,relatime)
/dev/mapper/vg-home /home ext4 (rw,nosuid,nodev,noatime,data=journal,commit=0)
tmpfs /tmp tmpfs (rw,noexec,nosuid,nodev,size=2800m,mode=1777)
/dev/sda3 /usr/portage/distfiles ext4 (rw,noatime,nodiratime,commit=360)
/dev/sda4 /home/downloads ext4 (rw,noatime,nodiratime,commit=0)
binfmt_misc /proc/sys/fs/binfmt_misc binfmt_misc (rw,noexec,nosuid,nodev)
ну и заодно man printf
esernar@moocs1n> whereis column
column:
esernar@moocs1n> whatis column
/usr/man/windex: No such file or directory
/usr/dt/man/windex: No such file or directory
/usr/share/man/windex: No such file or directory
/usr/openwin/man/windex: No such file or directory
esernar@moocs1n> uname -a
SunOS moocs1n 5.10 Generic_147440-12 sun4u sparc SUNW,SPARC-Enterprise
esernar@moocs1n>
lupo@gentoo-laptop ~ % equery b `which column`
* Searching for /usr/bin/column ...
sys-apps/util-linux-2.21-r1 (/usr/bin/column)
lupo@gentoo-laptop ~ % eix sys-apps/util-linux
[i] sys-apps/util-linux
Available versions: 2.20.1 2.20.1-r1 (~)2.20.1-r2 2.21 2.21-r1 {{+cramfs crypt ddate loop-aes ncurses nls old-linux perl selinux slang static-libs uclibc unicode}}
Installed versions: 2.21-r1(23:10:32 04.10.2012)(cramfs crypt ncurses nls perl unicode -ddate -loop-aes -old-linux -selinux -slang -static-libs -uclibc)
Homepage: http://www.kernel.org/pub/linux/utils/util-linux/
Description: Various useful Linux utilities
спасибо всем
printf '%-7s %-40s %-40s\n' "N/N" "RBS" "RNC"
printf '%-7s %-40s %-40s\n' "vp1" "$vp1" "$descrVP1"
printf '%-7s %-40s %-40s\n' "vc32" "$vc32" "$descrVC32"
printf '%-7s %-40s %-40s\n' "vc36" "$vc36" "$descrVC36"
printf '%-7s %-40s %-40s\n' "vc37" "$vc37" "$descrVC37"
printf '%-7s %-40s %-40s\n' "vc38" "$vc38" "$descrVC38"
printf '%-7s %-40s %-40s\n' "vc39" "$vc39" "$descrVC39"
printf '%-7s %-40s %-40s\n' "vc40" "$vc40" "$descrVC40"
ps. Альберто, к сожалению я не имею соответствующих прав..
ps. Альберто, к сожалению я не имею соответствующих прав..
Каких прав? Устанавливать программы?
[quote="moshell"]ps. Альберто, к сожалению я не имею соответствующих прав..
Каких прав? Устанавливать программы?[/quote]
их самых