How to number the ls output in unix?
        Posted  
        
            by Snehal 
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Snehal 
        
        
        
        Published on 2010-05-27T19:30:59Z
        Indexed on 
            2010/05/27
            20:31 UTC
        
        
        Read the original article
        Hit count: 361
        
I am trying to write a file with format - "id file_absolute_path" which basically lists down all the files recursively in a folder and give an identifier to each file listed like 1,2,3,4.
I can get the absolute path of the files recursively using the following command:
ls -d -1 $PWD/**/*/*
However, I am unable to give an identifier from the output of the ls command. I am sure this can be done using awk, but can't seem to solve it.
© Stack Overflow or respective owner