3 ms·
> grep . * I believe this command is present to prefix each line of output with the filename. But this ignores all the blank lines. That can of course be fixed
by susam 6y ago
> grep . *
I believe this command is present to prefix each line of output with the filename. But this ignores all the blank lines. That can of course be fixed easily with:
grep ^ *
Here is what I normally use myself if I want to show the content of files with their filenames:
tail -n +1 *
This shows the name of the file once at the beginning of each file and no more. Here is an example:
$ tail -n +1 *
==> bar.txt <==
bar 1
bar 2
bar 3
==> baz.txt <==
baz 1
baz 2
baz 3
==> foo.txt <==
foo 1
foo 2
foo 3
- ansible 6y agoThough you get error messages if there are any directories. This will filter those out: tail -n +1 `find * -maxdepth 0 -type f` Getting long enough to make an alias...