D
D
Denis2015-08-26 13:27:24
linux
Denis, 2015-08-26 13:27:24

How to delete all lines in a text file using sed, starting with a certain one (for example, from the 5th)?

Can you tell me how to delete all lines in a text file using sed, starting with a certain one (for example, from the 5th)? Thank you.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
abcd0x00, 2015-10-12
@abcd0x00

[[email protected] ~]$ cat /etc/passwd | sed '4q'
root:x:0:0:root:/root:/bin/bash
bin:x:1:1:bin:/bin:/sbin/nologin
daemon:x:2:2:daemon:/sbin:/sbin/nologin
adm:x:3:4:adm:/var/adm:/sbin/nologin
[[email protected] ~]$

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question