Tuesday, November 20, 2007

Display Lines Beginning with a Given String

The look utility displays any lines in file which contain string as a prefix.

Here's a quick entry on how to display lines that begins with a given string or word.

# cat testfile.txt
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
paper
paper2
this is not paper3
yo yo yo
~~~~~~~~~~~~~~~~~~~~~~~~~~~~

# look -df paper testfile.txt
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
paper
paper2
~~~~~~~~~~~~~~~~~~~~~~~~~~~~

HTH

0 comments:

Sign up for PayPal and start accepting credit card payments instantly.
ILoveTux - howtos and news | About | Contact | TOS | Policy