8

File1

Sergio
Lionel
Luis
Andreas
Gerard

I want my stdout to have just

Sergio
Gerard

How can I do this using the tail command and piping?

Kylo Ren
  • 115

2 Answers2

18

This should do the trick:

$ head -n 1 File1; tail -n 1 File1
vespid
  • 339
10

With sed:

sed -n -e '1p;$p' File1
cas
  • 78,579