-PID=$(sed -n 's/^ptrace *([^,]*, *\([0-9]*\),.*$/\1/p' "$1"|sort|uniq -c|sort -nr|head -n1|awk '{print $2}')
+if [ "$1" = "-n" ];then
+ n=true
+ shift
+else
+ n=false
+fi
+
+if [ -n "$2" ];then
+ PID="$2"
+else
+ PIDS="$(sed -n 's/^ptrace *(PTRACE_ATTACH, *\([0-9]*\),.*$/\1/p' "$1"|sort -u)"
+ if [ -z "$PIDS" ];then
+ echo >&2 "No PIDS found!"
+ exit 1
+ fi
+ PID='\('"$(echo "$PIDS"|tr '\n' ','|sed -e 's/,$//' -e 's/,/\\|/g')"'\)'
+fi