When we work with large text file for example text file contain 100000 lines of newspaper articles, this is difficult to read the content of line 30000th by common linux command such as vim, cat or nano.

Fortunately, we have the “sed” command. Now, for example,

  • If you want to see the line 30000th of sample.txt, just type:

sed -n “30000, 30000p” sample.txt

  • If you want to see from the line 30000th to the line 30005th of sample.txt, just type:

sed -n “30000, 30005p” sample.txt

Well, that easy!

Thanks for your reading!

--

--

Nguyen Ti Hon

Nguyen Ti Hon

I am a PhD candidate in data science, I am writing to improve my communication skills. Thanks for your reading! Best regard!