grep all lines except last code example Example: grep all except last sed \$d #For grepping all lines of a file except last line