我不确定如何从列表中排除一行

I am not sure how to exclude one line among the list

我想从以下列表中单独排除最后一行 "cwd=/"。休息我要显示

   1111 cwd=/path/to/file
   1139 cwd=/path/to/file
   1330 cwd=/path/to/file
   1330 cwd=/path/to/file
   2739 cwd=/path/to/file
   3273 cwd=/path/to/file
   9573 cwd=/path/to/file
   9981 cwd=/

我的意思一旦排除最后一行,我想要的结果如下:

   1111 cwd=/path/to/file
   1139 cwd=/path/to/file
   1330 cwd=/path/to/file
   1330 cwd=/path/to/file
   2739 cwd=/path/to/file
   3273 cwd=/path/to/file
   9573 cwd=/path/to/file

知道如何使用 grep 做到这一点吗?

错误匹配后需要一个字符。

grep 'cwd=/.'

你可以使用

sed '$d' filename

这仅适用于删除最后一行..