Search code examples
bashawksedlines

remove lines from file that does not have dot extension in bash


I am having such of file that contains lines as below:

/folder/share/folder1
/folder/share/folder1/file.gz
/folder/share/folder2/11072012
/folder/share/folder2/11072012/file1.rar

I am trying to remove these lines:

/folder/share/folder1/
/folder/share/folder2/11072012

To get a final result the following:

/folder/share/folder2/11072012/file1.rar
/folder/share/folder1/file.gz

In other words, I am trying to keep only the path for files and not directories.


Solution

  • You could to use the find command to get only the file list

    find <directory> -type f