Skip to content
Advertisement

how can i cut one line on two on a cat /ect/passwd?

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.

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement