Search code examples
grepls

list grep results in one line?


A quick question: ls . | grep -E "^[0-9]" gives me the results in the following format:

1
2
3
4
5

How can I let it be simply displayed as 1 2 3 4 5?


Solution

  • Try

    ls . | grep -E "^[0-9]" | tr '\n' ' ' ; echo