Is it possible with either find
or ls
to see, in a list of results, if any given entry is the nth result, what n is?
So, for example, pretend ls -l
returns:
total 0
-rw-rw---- 1 bigdog bigdog 0 Jan 3 17:13 a
-rw-rw---- 1 bigdog bigdog 0 Jan 3 17:13 b
-rw-rw---- 1 bigdog bigdog 0 Jan 3 17:13 c
Is there a way to get ls
to return 1,2,3 for files a,b,c respectively?
Or, find . -type f
returns:
./a
./b
./c
Any way to get something like:
1 ./a
2 ./b
3 ./c
I am aware of ls | wc -l
and the like, but that is not what I'm looking for.
line number output site:unix.stackexchange.com
(it was the last result on the first page.) The Stack Exchange site search is notoriously bad, Googling with a site restriction often yields better results. – muru Jan 4 '16 at 1:35