Παρασκευή 7 Μαρτίου 2014

Extract a number of lines from the middle of a text file

I had this issue many times and maybe you did too.

So I would like to share what I found.

Say you have a text file

file.txt:

line 1
line 2
line 3
line 4
line 5

so you want to take only the important lines 2 to 4 so what you do?

simple:

cat file.txt |sed -n '2,4p'

line 2
line 3
line 4

---------
You are done!!
 


Δεν υπάρχουν σχόλια:

Δημοσίευση σχολίου