I’m trying to write a command that shows all odd lines of
/etc/passwd
:
I’ve tried:
sh-3.2$ cat /etc/passwd | grep -vn # | sed '0~2d'
but it didn’t work
sed: 1: "0~2d": invalid command code ~
Is there a different way to obtain the result?
Advertisement
Answer
The step syntax is a GNU extension.
sed 'n;d'
should be the portable version of your sed
invocation.