hello,
ps -fu|...
produces lines which can have last column like:
./abcd.sh
abcd.sh
/home/user/abcd.sh
./user/abcd.sh
I need to find all lines which either alone "abcd.sh" or "/abcd.sh" and also to be sure is not preceded by commands like vi or more (only running script processes).
What I have combined now is:
how to get exactly what I need?
how to print columns which ends with "/abcd.sh" or are alone "abcd.sh" ($NF == a)?
ps -fu|...
produces lines which can have last column like:
./abcd.sh
abcd.sh
/home/user/abcd.sh
./user/abcd.sh
I need to find all lines which either alone "abcd.sh" or "/abcd.sh" and also to be sure is not preceded by commands like vi or more (only running script processes).
What I have combined now is:
Code:
# P=abcd.sh
# ps -furoot|awk -va=$N '$NF ~ a {print $(NF-1)" "$NF}'|grep -v -e ^vi -e ^more
how to get exactly what I need?
how to print columns which ends with "/abcd.sh" or are alone "abcd.sh" ($NF == a)?