FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Debian > Debian User

 
 
LinkBack Thread Tools
 
Old 08-28-2010, 04:08 AM
T o n g
 
Default text formatting tool that can produce output like ls(1)?

On Sat, 28 Aug 2010 09:14:01 +0800, Zhang Weiwu wrote:

> The output of "ls" is pretty good because:
>
> 1. It calculate column width from widest columns. 2. It knows one
> Chinese ideograph is two letters wide. 3. It aligns columns by
> flexible space character instead of tab
>
> Is there a text formatting command that formats text like "ls" while
> take user supplied input?

You didn't provide a test case so here is mine:

$ perl -e 'foreach $ii (1..9){ foreach $jj (1..$ii) {print $ii; }; print
" $ii
"; } ' | tee /tmp/f1
1 1
22 2
333 3
4444 4
55555 5
666666 6
7777777 7
88888888 8
999999999 9

$ cat /tmp/f1 | column -t
1 1
22 2
333 3
4444 4
55555 5
666666 6
7777777 7
88888888 8
999999999 9

I also tried Chinese and it seems to be fine. Don't know if the following
will come up as expected after post...

echo "媒体称香港青年系被*方大锤重创 x" >> /tmp/f1

$ cat /tmp/f1 | column -t
1 1
22 2
333 3
4444 4
55555 5
666666 6
7777777 7
88888888 8
999999999 9
媒体称香港青年系被*方大锤重创 x

--
Tong (remove underscore(s) to reply)
http://xpt.sourceforge.net/techdocs/
http://xpt.sourceforge.net/tools/


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: i5a24n$mcf$2@dough.gmane.org">http://lists.debian.org/i5a24n$mcf$2@dough.gmane.org
 
Old 08-30-2010, 03:22 AM
Zhang Weiwu
 
Default text formatting tool that can produce output like ls(1)?

On 2010年08月28日 12:08, T o n g wrote:
> You didn't provide a test case so here is mine: (followed by a case using column)
>

Thank you very much indeed. I wasn't aware of "column" command. Thank
you for your test case as well!

Best regards
Zhang Weiwu


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 4C7B2408.7060006@realss.com">http://lists.debian.org/4C7B2408.7060006@realss.com
 

Thread Tools




All times are GMT. The time now is 11:39 AM.

VBulletin, Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org