Search code examples
linuxshellunixgrepls

Display multiple files in Linux/Unix


I'm looking to display 3 different files, if they exist. I thought the following would work, but it doesn't:

ls -R | grep 6-atom2D.vector$ 6-atom2D.klist 6-atom2D.struct

How can I do it?


Solution

  • ls -R | egrep "6-atom2D\.vector$|6-atom2D\.klist|6-atom2D\.struct"
    

    If $ is supposed to be end of line regexp, then you might need to use \> instead. That works for me at least.

    Edit: Backslash before .