Hey there is column in linux, but its not a command in unix, i was wondering what a simple script would be that i could make to do something along the lines of column.
what exactly you wanna do?? your question is not that clear..
Try this:
#!/usr/bin/awk -f
BEGIN {
if (!(maxwidth > 0)) maxwidth=80
}
length > maxlength {maxlength=length}
{a[NR]=$0}
END{
maxlength++ # so we have a gap between columns
cols=int(maxwidth/maxlength)
f="%-"maxlength"s"
for (i=1;i<=NR;i++) {
printf(f,a)
if (!(i%cols)) print ""
}
if (--i%cols) print ""
}
Let's say you call it mycolumns, you can specify the width to use using something like ls /tmp | mycolumns maxwidth=100. Otherwise it will default to 80.
thanks for your reply but i dont want it to be in java, just using the basic commands within unix, i cant find the right command to use to make a basic like 1 line script that acts just like column in linux
What about pr command, it can do columns (I used it a lot in my early days...)
Some of us are not familiar with the columns command. Please show example(s) of input and desired output. And the rules used, if not very clear form the examples.
You may then see other creative solutions.
the column utility takes input and formats it into columns (three columns as defualt i think) but its only in linux, not in unix. i know there are a few regular commands i can use to make a simple script to use it in unix, i just dont know the one command that could format it. would it be fmt
Java? That's an awk script.
Could could put it on one line and use no comments and shorter variable names if you wish, e.g.
ls | awk 'BEGIN{if(!(w>0))w=80}length>m{m=length}{a[NR]=$0}END{c=int(w/++m);for(i=1;i<=NR;i++){printf("%-"m"s",a);if(!(i%c))print""}if(--i%c)print""}'
You could implement the same algorithm easily enough in pure shell code or perl if you preferred.
You may be thinking of something like ls | paste - - - - (to format ls output into four columns, but that won't adjust the column widths to make them line up.
I overlooked this post... yes, I think pr is probably the most sensible option.
Please help me in troubleshooting my problem in Samba?
I tried to instal Samba 3.0.24 in our SCO UnixWare 7.1.4 but after installing the nmbd daemon is not running.
When i check the syslog from /var/adm, the following error appears:
Sep 30 13:04:22 unixeei nmbd[25169]: bind failed on port 137 socket_addr =0.0.0.0.
Thanks 
Eric
Please start your own thread.
As I already mentionned, look at pr...
co:/home/vbe/wks $ cat gaga
1234567890
qwertzuiop
asdfghjkl
<yxcvbnm,.
co:/home/vbe/wks $ pr -c 3 gaga|more
Oct 01 10:48 2008 gaga Page 1
1234567890 asdfghjkl <yxcvbnm,.
qwertzuiop
column uses environment variable COLUMNS as a definition of the width of the output in characters ( example 80 ) unless -c is specified.