2011-06-24 65 views

回答

1

-l/var/www/folder | grep --invert-match「@ somedomain.com」| grep -E -o -color「\ b [a-zA-Z0-9 .-] + @ [a-zA-Z0-9 .-] +。[a-zA-Z0-9 .-] + \ b「>> test.txt

+0

偉大的工程,歡呼聲 – Grimlockz

2

這個怎麼樣

ls -l /var/www/folder | grep -v "@somedomain.com" 

測試用例:

$ mkdir -p /tmp/test && cd $_ 
$ touch {a,b,c,d}@domain.com 
$ touch {e,f}@somedomain.com 
$ ls 
domain.com [email protected] [email protected] [email protected] [email protected] [email protected] 
$ ls -1 | grep -v "@somedomain.com" 
[email protected] 
[email protected] 
[email protected] 
[email protected] 

這裏是男人頁說什麼-v

-v, --invert-match 
     Invert the sense of matching, to select non-matching lines. (-v is specified by POSIX.) 
+0

我需要使用@otherdomain grep所有其他文件夾,但不使用@ domain.com,所以我認爲排除會起作用 – Grimlockz

+0

我不明白上述情況如何,但無論如何:) – c00kiemon5ter

相關問題