How to get ONLY Second line with SED

You don’t really need Sed, but if the pourpose is to learn… you can use -n

n read the next input line and starts processing the newline with the command rather than the first command

sed -n 2p somefile.txt

Edit: You can also improve the performance using the tip that manatwork mentions in his comment:

sed -n '2{p;q}' somefile.txt

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)