0

Edit: The post was closed for being a duplicate, but the best answer for me wasn't in either of those questions. using

head *

does exactly what I want


I have a directory that has a bunch of 1-line files in it representing some data I'd like to see. I'm wondering if there's a simple command or chain of commands I can use to get a view like

file1.txt
data1

file2.txt data2

file3.txt data3 ...

Mason
  • 479

1 Answers1

1

You could open all of them in a pager like more:

more file*

That will look like this:

 $ more file*
::::::::::::::
file1
::::::::::::::
data 1
::::::::::::::
file10
::::::::::::::
data 10
::::::::::::::
file11
::::::::::::::
data 11

And pressing enter will load more and more files.

Alternatively, you can simply cat file*, but that won't have the header. You can add the header with something like this:

for f in file*; do echo "===== $f ====="; cat "$f"; done
terdon
  • 242,166