1
ls -L | grep -v ^zip

What i understand from this command is, it is doing a listing and piping the output to a grep command which performs grep on the received output file list to select any file with file name not containing text "zip" and any file with file name containing text "zip".

If this is correct, then it seems useless or counter productive. Am i wrong somewhere?

4

2 に答える 2

3

テキスト「zip」を含まないファイル名のファイルとテキスト「zip」を含むファイル名のファイルを選択するには

どうやってその結論に達したのかわかりません。^zipで始まる行に一致し、パターンzip-v否定します。

于 2012-07-19T10:15:10.603 に答える
2

-v「一致しない」を意味し^、行の先頭です:

$ cat in.txt                
foo
zip
bar
--zip
baz
 zip
qux
$ $ grep -v '^zip' < in.txt   
foo
bar
--zip
baz
 zip
qux
于 2012-07-19T10:16:01.150 に答える