1

I am using this command:

wc -l */* >> file

which creates a file in current directory of all the appropriate info from the subdirectories. My problem is that it pastes the data in 1 long column. Can I have it paste the data in several columns?

0

The pr command may help.

For example:

   wc -l */* |  pr -2 -t

will give your output in two columns.

0

The 'paste' command is probably what you're looking for. An example:

$ cut -d: -f1 /etc/group|paste - - - -
root    bin     daemon  sys
adm     tty     disk    lp
mem     kmem    wheel   mail
uucp    man     games   gopher
video   dip     ftp     lock
audio   nobody  users   dbus
...

There I used cut to get a list of the names in my /etc/group file, then used paste to print it 4-up. However many hyphens you list on the paste command line, paste will gobble up another line and put it in that column.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.