- -
Поиск grep-ом
(
http://forum.oszone.net/showthread.php?t=331443)
blackeangel |
25-11-2017 13:26 2780056 |
Поиск grep-ом
Собственно, есть код
Код:
find /data | grep -v '/data/media'
Но при такой постановке из строк
/data/media
/data/media/folder/folder
/data/mediaservice
grep забирает все 3 строки, а надо лишь чтоб первые 2
Как быть?
|
CyberDaemon |
03-12-2017 16:58 2782046 |
Цитата:
Цитата man grep
-w, --word-regexp
Select only those lines containing matches that form whole words. The test is that the matching substring must either
be at the beginning of the line, or preceded by a non-word constituent character. Similarly, it must be either at the
end of the line or followed by a non-word constituent character. Word-constituent characters are letters, digits, and
the underscore.
|
find /data | grep -vw '/data/media'
Цитата:
/data/
/data/mediaservice
|
|
Код:
find /data | grep -v '/data/media' | head -n2
не уверен, что понял вопрос :)
|
DJ Mogarych |
27-12-2017 16:01 2787395 |
Добавить вторую команду
Код:
find /data/mediaservice
|
Код:
find /data | grep -v '/data/media[^/]\+'
|
Время: 15:52.
© OSzone.net 2001-