1

Can anyone please point to some good sample files that helps to learn grep. This is for academic use. It should be a large one so that students could understand its importance

1
  • Perhaps /usr/share/dict
    – Kevin
    Dec 7, 2012 at 4:05

2 Answers 2

2

The file /etc/services contains a list of known services. It is too long to read through, and it might be a good real world example of when to use grep.

linux@host$ cat /etc/services | grep 'http'

To demonstrate how to find out which port http uses, or

linux@host$ grep '80/tcp' /etc/services

To find out what service you can expect to find on port 80

2

You might want to use books from Project Gutenberg. They are in the public domain, are quite large (you can cat some books together if desired) and can be used to devise many real-world examples of grep.

Otherwise, Wikipedia gives a bunch of public domain resources which might be available in plain text format.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .