Domain Name Forum

Domain Name Forum (http://www.domainnameforum.org/index.php)
-   Shell Scripting (http://www.domainnameforum.org/forumdisplay.php?f=130)
-   -   grep all but first line (http://www.domainnameforum.org/showthread.php?t=150765)

webdev 03-19-2011 09:40 PM

grep all but first line
 
"ps aux" outputs the following as the first line: USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND how can I preserve this line if I do a "ps aux | grep " so that I can still see the header for each column? In essence, I want to grep all but the first line...

steffidsouza46 07-29-2017 11:55 AM

The -n +2 means “start passing through on the second line of output”. This is a quick hacky way: ls -lart. grep -v ^total . Basically, remove any lines that start with "total", which in ls output should only be the first line.


All times are GMT -4. The time now is 01:03 PM.

Powered by vBulletin®
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.