Search code examples
unixgrepls

Unix: grep and ls


I need to find a file in my current directory with the following restrictions: are at least two characters long and don't have the following letters anywhere in the first two characters: a,b,c,f,h,x,y,z.

I tried

$ ls | egrep '[[:alpha:]]{2,}' | grep -v '[abcfhxyz]'

but it isn't working


Solution

  • Like this?:

    $ ls [^abcfhxyz][^abcfhxyz]*