grep -v는 문자열을 제외하지 않습니다.

grep -v는 문자열을 제외하지 않습니다.

원하지 않는 특정 단어가 포함된 문자열을 제거하여 캡처할 플래그의 범위를 좁히려고 했기 때문에 다음을 사용했습니다.

cat $(find / -size 33c -group bandit6 -user bandit7) | grep -v 'Permission'

하지만 내 결과는 결국

find: ‘/cgroup2/csessions’: Permission denied
find: ‘/home/bandit28-git’: Permission denied
find: ‘/home/bandit30-git’: Permission denied
find: ‘/home/bandit31-git’: Permission denied
find: ‘/home/bandit5/inhere’: Permission denied
find: ‘/home/bandit27-git’: Permission denied
find: ‘/home/bandit29-git’: Permission denied
find: ‘/tmp’: Permission denied
find: ‘/lost+found’: Permission denied
find: ‘/root’: Permission denied
find: ‘/etc/ssl/private’: Permission denied
find: ‘/etc/lvm/backup’: Permission denied
find: ‘/etc/lvm/archive’: Permission denied
find: ‘/etc/polkit-1/localauthority’: Permission denied
find: ‘/sys/fs/pstore’: Permission denied
find: ‘/proc/tty/driver’: Permission denied
find: ‘/proc/24068/task/24068/fd/6’: No such file or directory
find: ‘/proc/24068/task/24068/fdinfo/6’: No such file or directory
find: ‘/proc/24068/fd/5’: No such file or directory
find: ‘/proc/24068/fdinfo/5’: No such file or directory
find: ‘/boot/lost+found’: Permission denied
HKBPTKQnIay4Fw76bEy8PVxKEDQRKTzs

내가 원하는 건 오직 그것 뿐일 때

HKBPTKQnIay4Fw76bEy8PVxKEDQRKTzs

`

답변1

그럼 이게 $()문제인거 같네요

cat $(find / -size 33c -group bandit6 -user bandit7) 2>/dev/null

하지만 작동하지 않습니다

cat $(find / -size 33c -group bandit6 -user bandit7 2>/dev/null)

grep -v괄호 안에 stderr과 섞일 수도 있다고 생각합니다.

관련 정보