grep -v is not excluding the strings [duplicate]












-1















This question already has an answer here:




  • How do I remove “permission denied” printout statements from the find program?

    3 answers



  • How to skip “permission denied” errors when running find in Linux? [duplicate]

    1 answer




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


`










share|improve this question















marked as duplicate by Jeff Schaller, roaima, mosvy, Fabby, George Vasiliou Dec 28 '18 at 23:04


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.















  • it does appear to be and issue with stderr but neither 2>&1 or any use of /dev/null seem to resolve this
    – ghostpunk
    Dec 28 '18 at 19:34












  • unix.stackexchange.com/questions/42841/…
    – Jeff Schaller
    Dec 28 '18 at 19:35










  • yeh still 2>/dev/null has no affect
    – ghostpunk
    Dec 28 '18 at 19:42










  • where'd you put it? It needs to relate to the find command: find / -size 33c -group bandit6 -user bandit7 2>/dev/null
    – Jeff Schaller
    Dec 28 '18 at 19:42










  • solved it is because 2>/dev/null was not inside $(should be in here)
    – ghostpunk
    Dec 28 '18 at 19:52
















-1















This question already has an answer here:




  • How do I remove “permission denied” printout statements from the find program?

    3 answers



  • How to skip “permission denied” errors when running find in Linux? [duplicate]

    1 answer




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


`










share|improve this question















marked as duplicate by Jeff Schaller, roaima, mosvy, Fabby, George Vasiliou Dec 28 '18 at 23:04


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.















  • it does appear to be and issue with stderr but neither 2>&1 or any use of /dev/null seem to resolve this
    – ghostpunk
    Dec 28 '18 at 19:34












  • unix.stackexchange.com/questions/42841/…
    – Jeff Schaller
    Dec 28 '18 at 19:35










  • yeh still 2>/dev/null has no affect
    – ghostpunk
    Dec 28 '18 at 19:42










  • where'd you put it? It needs to relate to the find command: find / -size 33c -group bandit6 -user bandit7 2>/dev/null
    – Jeff Schaller
    Dec 28 '18 at 19:42










  • solved it is because 2>/dev/null was not inside $(should be in here)
    – ghostpunk
    Dec 28 '18 at 19:52














-1












-1








-1








This question already has an answer here:




  • How do I remove “permission denied” printout statements from the find program?

    3 answers



  • How to skip “permission denied” errors when running find in Linux? [duplicate]

    1 answer




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


`










share|improve this question
















This question already has an answer here:




  • How do I remove “permission denied” printout statements from the find program?

    3 answers



  • How to skip “permission denied” errors when running find in Linux? [duplicate]

    1 answer




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


`





This question already has an answer here:




  • How do I remove “permission denied” printout statements from the find program?

    3 answers



  • How to skip “permission denied” errors when running find in Linux? [duplicate]

    1 answer








grep find pipe






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Dec 28 '18 at 20:21









Jeff Schaller

39k1054125




39k1054125










asked Dec 28 '18 at 18:57









ghostpunkghostpunk

11




11




marked as duplicate by Jeff Schaller, roaima, mosvy, Fabby, George Vasiliou Dec 28 '18 at 23:04


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.






marked as duplicate by Jeff Schaller, roaima, mosvy, Fabby, George Vasiliou Dec 28 '18 at 23:04


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.














  • it does appear to be and issue with stderr but neither 2>&1 or any use of /dev/null seem to resolve this
    – ghostpunk
    Dec 28 '18 at 19:34












  • unix.stackexchange.com/questions/42841/…
    – Jeff Schaller
    Dec 28 '18 at 19:35










  • yeh still 2>/dev/null has no affect
    – ghostpunk
    Dec 28 '18 at 19:42










  • where'd you put it? It needs to relate to the find command: find / -size 33c -group bandit6 -user bandit7 2>/dev/null
    – Jeff Schaller
    Dec 28 '18 at 19:42










  • solved it is because 2>/dev/null was not inside $(should be in here)
    – ghostpunk
    Dec 28 '18 at 19:52


















  • it does appear to be and issue with stderr but neither 2>&1 or any use of /dev/null seem to resolve this
    – ghostpunk
    Dec 28 '18 at 19:34












  • unix.stackexchange.com/questions/42841/…
    – Jeff Schaller
    Dec 28 '18 at 19:35










  • yeh still 2>/dev/null has no affect
    – ghostpunk
    Dec 28 '18 at 19:42










  • where'd you put it? It needs to relate to the find command: find / -size 33c -group bandit6 -user bandit7 2>/dev/null
    – Jeff Schaller
    Dec 28 '18 at 19:42










  • solved it is because 2>/dev/null was not inside $(should be in here)
    – ghostpunk
    Dec 28 '18 at 19:52
















it does appear to be and issue with stderr but neither 2>&1 or any use of /dev/null seem to resolve this
– ghostpunk
Dec 28 '18 at 19:34






it does appear to be and issue with stderr but neither 2>&1 or any use of /dev/null seem to resolve this
– ghostpunk
Dec 28 '18 at 19:34














unix.stackexchange.com/questions/42841/…
– Jeff Schaller
Dec 28 '18 at 19:35




unix.stackexchange.com/questions/42841/…
– Jeff Schaller
Dec 28 '18 at 19:35












yeh still 2>/dev/null has no affect
– ghostpunk
Dec 28 '18 at 19:42




yeh still 2>/dev/null has no affect
– ghostpunk
Dec 28 '18 at 19:42












where'd you put it? It needs to relate to the find command: find / -size 33c -group bandit6 -user bandit7 2>/dev/null
– Jeff Schaller
Dec 28 '18 at 19:42




where'd you put it? It needs to relate to the find command: find / -size 33c -group bandit6 -user bandit7 2>/dev/null
– Jeff Schaller
Dec 28 '18 at 19:42












solved it is because 2>/dev/null was not inside $(should be in here)
– ghostpunk
Dec 28 '18 at 19:52




solved it is because 2>/dev/null was not inside $(should be in here)
– ghostpunk
Dec 28 '18 at 19:52










1 Answer
1






active

oldest

votes


















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






share|improve this answer





















  • If you explain why the first command does not work and the second command does the job, your answer will get some upvotes.
    – George Vasiliou
    Dec 28 '18 at 23:07


















1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









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






share|improve this answer





















  • If you explain why the first command does not work and the second command does the job, your answer will get some upvotes.
    – George Vasiliou
    Dec 28 '18 at 23:07
















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






share|improve this answer





















  • If you explain why the first command does not work and the second command does the job, your answer will get some upvotes.
    – George Vasiliou
    Dec 28 '18 at 23:07














0












0








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






share|improve this answer












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







share|improve this answer












share|improve this answer



share|improve this answer










answered Dec 28 '18 at 19:48









ghostpunkghostpunk

11




11












  • If you explain why the first command does not work and the second command does the job, your answer will get some upvotes.
    – George Vasiliou
    Dec 28 '18 at 23:07


















  • If you explain why the first command does not work and the second command does the job, your answer will get some upvotes.
    – George Vasiliou
    Dec 28 '18 at 23:07
















If you explain why the first command does not work and the second command does the job, your answer will get some upvotes.
– George Vasiliou
Dec 28 '18 at 23:07




If you explain why the first command does not work and the second command does the job, your answer will get some upvotes.
– George Vasiliou
Dec 28 '18 at 23:07



Popular posts from this blog

Morgemoulin

Scott Moir

Souastre