2011-05-31 9 views
7

मुझे लगता है कि tail +2 सोलारिस ksh में समर्थित है देखा है, लेकिन रेड हैट लिनक्स में कोई त्रुटि सामने आ जाएगा:क्या "पूंछ +2" लिनक्स द्वारा समर्थित है?

c008>> ps -p 4009,6282,31401,31409 | tail +2 
tail: cannot open `+2' for reading: No such file or directory 

, सोलारिस में रहते हुए

bjbldd>> ps -p 2622,16589,11719,846 |tail +2 
16589 ??  0:00 xterm 
    846 pts/180 0:00 cscope 
11719 pts/180 0:00 cscope 
2622 pts/114 0:00 apxcscop 

PID TTY TIME CMD की लाइन "पूंछ से बाहर रखा गया है 2 "।

मुझे पता है grep -v PID काम करेगा। लेकिन मुझे आश्चर्य है कि लिनक्स पूंछ के लिए समान विकल्प हैं?

उत्तर

17

tail(1) से:

-n, --lines=K 
      output the last K lines, instead of the last 10; or 
      use -n +K to output lines starting with the Kth 

तो -n +2 या --lines=+2 कोशिश:

$ ps -p 20085 9530 29993 2069 2012 | tail -n +2 
2012 ?  Sl  0:00 /usr/bin/gnome-keyring-daemon --daemonize --login 
2069 ?  S  0:00 /usr/bin/dbus-launch --exit-with-session i3 
9530 ?  Sl  0:01 /usr/lib/udisks/udisks-daemon 
20085 ?  S  0:00 /usr/sbin/apache2 -k start 
29993 ?  S  0:00 [kworker/1:0] 
$ 
1

मैं सोलारिस tail +2 वाक्य रचना से परिचित था, लेकिन यह Ubuntu पर काम करने के लिए प्रतीत नहीं होता।

सुपर उपयोगकर्ता से इस उत्तर से काम करने लगता है:

tail --lines=+100 <file> 

स्रोत: https://superuser.com/questions/62970/unix-cat-starting-from-line