Date: Thu, 11 May 2000 00:39:42 +0300 From: Giorgos Keramidas <keramida@ceid.upatras.gr> To: Dan Larsson <dl@tyfon.net> Cc: questions@FreeBSD.ORG Subject: Re: making even columns in sh Message-ID: <20000511003941.A57999@hades.hell.gr> In-Reply-To: <NEBBJANJCNNAKCPFKHHFMENECBAA.dl@tyfon.net>; from dl@tyfon.net on Wed, May 10, 2000 at 09:43:29AM %2B0200 References: <NEBBJANJCNNAKCPFKHHFMENECBAA.dl@tyfon.net>
next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, May 10, 2000 at 09:43:29AM +0200, Dan Larsson wrote: > I've written a simple script to display usernames with their $HOME as > root (chrooted). The $HOME variable is extracted with awk and sed. > > However as usernames are not all the same lenght the columns (username > chroot/path ) don't run straight down, that is the chroot/path column > start depends on how long the username is. > > Is there some way I can manipulate the rows so that the second column > is displayed in an 'orderly' fashion using sh? Yet another pass through awk can make things a lot more beautiful. Try something like: % your commands here | awk '{ printf "%-8s %s\n", $0; }' The %-8s format string means print the argument in a string that is 8 characters wide, but left justified. More elaborate formats are possible, but that is probably off-topic. Ciao, Giorgos. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20000511003941.A57999>