I'm using:
ls /proc | grep -v "^[0-9].*"
to get a list of all the files and directories in /proc that don't begin with numbers. The output is a single column list, i.e.:
acpi
asound
buddyinfo
bus
How can I make this a multi-column or item list, i.e.:
acpi asound buddyinfo bus
or
acpi,asound,buddyinfo,bus
I tried:
$ ls /proc | grep -v "^[0-9].*" | column -c5
but still got 1 column.
Best Answer
Use
xargs
:The
command
part is necessary because if yourls
is aliased tols --color
for example, it adds non-printing escape sequences to its output thatgrep
somehow searches through and produces undesirable results.Other options
If you don't mind your
PWD
changing:If you don't want to change your
PWD
:Or: