FreeBSD - how to exclude some pattern with grep?
Clash Royale CLAN TAG#URR8PPP
up vote
0
down vote
favorite
FreeBSD 11.0-RELEASE-p1 FreeBSD 11.0-RELEASE-p1 #0 root@releng2.nyi.freebsd.org:/usr/obj/usr/src/sys/GENERIC amd64
grep (GNU grep) 2.5.1-FreeBSD
Hi. I want to check availability of Asterisk process, so I use this command:
ps aux | grep /usr/local/sbin/asterisk
But the output is not relevant bacause it contains two strings (the first is for Asterisk process and the second is for grep process):
asterisk 44044 9.8 2.1 866912 133628 - Is 14:35 121:27.41 /usr/local/sbin/asterisk -n -F -U asterisk
root 44242 0.0 0.0 14796 2484 4 S+ 09:50 0:00.27 grep /usr/local/sbin/asterisk
So I want to exclude "grep" string.
In Linux I can use flag -v, but what should I do in FreeBSD?
grep freebsd
add a comment |Â
up vote
0
down vote
favorite
FreeBSD 11.0-RELEASE-p1 FreeBSD 11.0-RELEASE-p1 #0 root@releng2.nyi.freebsd.org:/usr/obj/usr/src/sys/GENERIC amd64
grep (GNU grep) 2.5.1-FreeBSD
Hi. I want to check availability of Asterisk process, so I use this command:
ps aux | grep /usr/local/sbin/asterisk
But the output is not relevant bacause it contains two strings (the first is for Asterisk process and the second is for grep process):
asterisk 44044 9.8 2.1 866912 133628 - Is 14:35 121:27.41 /usr/local/sbin/asterisk -n -F -U asterisk
root 44242 0.0 0.0 14796 2484 4 S+ 09:50 0:00.27 grep /usr/local/sbin/asterisk
So I want to exclude "grep" string.
In Linux I can use flag -v, but what should I do in FreeBSD?
grep freebsd
add a comment |Â
up vote
0
down vote
favorite
up vote
0
down vote
favorite
FreeBSD 11.0-RELEASE-p1 FreeBSD 11.0-RELEASE-p1 #0 root@releng2.nyi.freebsd.org:/usr/obj/usr/src/sys/GENERIC amd64
grep (GNU grep) 2.5.1-FreeBSD
Hi. I want to check availability of Asterisk process, so I use this command:
ps aux | grep /usr/local/sbin/asterisk
But the output is not relevant bacause it contains two strings (the first is for Asterisk process and the second is for grep process):
asterisk 44044 9.8 2.1 866912 133628 - Is 14:35 121:27.41 /usr/local/sbin/asterisk -n -F -U asterisk
root 44242 0.0 0.0 14796 2484 4 S+ 09:50 0:00.27 grep /usr/local/sbin/asterisk
So I want to exclude "grep" string.
In Linux I can use flag -v, but what should I do in FreeBSD?
grep freebsd
FreeBSD 11.0-RELEASE-p1 FreeBSD 11.0-RELEASE-p1 #0 root@releng2.nyi.freebsd.org:/usr/obj/usr/src/sys/GENERIC amd64
grep (GNU grep) 2.5.1-FreeBSD
Hi. I want to check availability of Asterisk process, so I use this command:
ps aux | grep /usr/local/sbin/asterisk
But the output is not relevant bacause it contains two strings (the first is for Asterisk process and the second is for grep process):
asterisk 44044 9.8 2.1 866912 133628 - Is 14:35 121:27.41 /usr/local/sbin/asterisk -n -F -U asterisk
root 44242 0.0 0.0 14796 2484 4 S+ 09:50 0:00.27 grep /usr/local/sbin/asterisk
So I want to exclude "grep" string.
In Linux I can use flag -v, but what should I do in FreeBSD?
grep freebsd
grep freebsd
asked 10 mins ago
àþôøýúð
4816
4816
add a comment |Â
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
0
down vote
Quick answer: Change the pattern so it doesn't show up in ps, but still matches, for example use square brackets to search for
/usr/local/sbin/asteris[k]
Maybe better answer: Use a program like pgrep
to "look up or signal processes based on name and other attributes"
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
Quick answer: Change the pattern so it doesn't show up in ps, but still matches, for example use square brackets to search for
/usr/local/sbin/asteris[k]
Maybe better answer: Use a program like pgrep
to "look up or signal processes based on name and other attributes"
add a comment |Â
up vote
0
down vote
Quick answer: Change the pattern so it doesn't show up in ps, but still matches, for example use square brackets to search for
/usr/local/sbin/asteris[k]
Maybe better answer: Use a program like pgrep
to "look up or signal processes based on name and other attributes"
add a comment |Â
up vote
0
down vote
up vote
0
down vote
Quick answer: Change the pattern so it doesn't show up in ps, but still matches, for example use square brackets to search for
/usr/local/sbin/asteris[k]
Maybe better answer: Use a program like pgrep
to "look up or signal processes based on name and other attributes"
Quick answer: Change the pattern so it doesn't show up in ps, but still matches, for example use square brackets to search for
/usr/local/sbin/asteris[k]
Maybe better answer: Use a program like pgrep
to "look up or signal processes based on name and other attributes"
answered 1 min ago
Xen2050
1,107811
1,107811
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f480289%2ffreebsd-how-to-exclude-some-pattern-with-grep%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password