Unix Blog

Monday, October 25, 2010

Limit results with grep

Create a file named servers with the following
server_apache1=1.1.1.1
server_apache2=1.1.1.2
server_apache3=1.1.1.3

grep apache servers
will return output
server_apache1=1.1.1.1
server_apache2=1.1.1.2
server_apache2=1.1.1.3

To limit the grep results, try
grep apache servers-m 1
Output: server_apache1=1.1.1.1

grep apache servers-m 2
Output:
server_apache1=1.1.1.1
server_apache2=1.1.1.2

posted by Jayanthi Krishnamurthy @ 10:31 AM   0 Comments

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home

Newer›  ‹Older

About Me

Name: Jayanthi Krishnamurthy

View my complete profile

Posts

  • Limit results with grep

Older Posts Newer Posts

Archives

Subscribe to
Posts [Atom]