Bash --- columns problem ??

Steven W. Orr steveo at syslang.net
Sun Dec 16 03:36:14 UTC 2007


On Saturday, Dec 15th 2007 at 05:52 -0000, quoth William Case:

=>Hi;
=>
=>I am having a bit of a brain cramp.
=>
=>I have a text file with 1100 one word lines in it.  I would like to
=>transpose that file into a three column text file reducing it from 23
=>pages to 8 pages before printing.  I did something similar from the
=>command line over a year ago, but for the life of me I can't remember
=>how.  I do remember that it was simple at the time.
=>
=>I have tried every possible combination I can think of with grep |
=>column.
=>
=>If this problem is familiar to someone could they just point me; tickle
=>my memory?

Why use grep or pr or any other shellout when you can just do it right 
from within bash?

myRead()
{
    typeset line1, line2, line3
    read line1
    read line2
    read line3
    echo "$line1 $line2 $line3"
    [[ -n "$line1" && -n "$line2" && -n "$line3" ]]
}
while myRead
do
    :
done < /usr/share/dict/words 

-- 
Time flies like the wind. Fruit flies like a banana. Stranger things have  .0.
happened but none stranger than this. Does your driver's license say Organ ..0
Donor?Black holes are where God divided by zero. Listen to me! We are all- 000
individuals! What if this weren't a hypothetical question?
steveo at syslang.net




More information about the users mailing list