Re: Bash --- columns problem ??

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Dec 15, 2007 6:07 AM, G.Wolfe Woodbury <ggw@xxxxxxxxxxxxxxxxxxx> wrote:
> On Sat, Dec 15, 2007 at 05:52:25AM -0500, William Case wrote:
> > 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?
>
> There are some options to the pr(1) command that will multi-column on the way to
> printing.
>
> --
> Wolfe
>
In absence of that doing it, another option that comes to mind is a
simple for loop (looping to 3) that removes CR/LF (or is it just LF?)
and dumps that loop to the printer or a new file.  Put that loop
inside a larger for loop (for lines in ($cat {data_file}) do...).  I'd
have to take time to play around with it to get the exact syntax but
you get the general idea.  Or a sed command to remove all of the end
of lines (LF or CR/LF) such as "s/[\012\015]/ /g" to replace CR/LF
with a space instead to get a space delimited list of words and then
process it through pr if it doesn't work with the LF.

But the pr option suggested seems to be a valid option.  Check out
http://linux.about.com/library/cmd/blcmdl1_pr.htm (or man pr of
course).

Jacques B


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux