-1

im trying to narrow down a flag to catch by removing strings with certain unwanted words so i use

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

but my results end up being

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

when all i want is

HKBPTKQnIay4Fw76bEy8PVxKEDQRKTzs

`

Jeff Schaller
  • 67,283
  • 35
  • 116
  • 255

1 Answers1

0

so it appears to $() was the problem

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

will not work, however

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

will work i imagine grep -v may work with some mixture of stderr inside the brackets aswell