Search

look: command to search lines begining with a string


look

look "string" "filename" 

The command "look" searhes for lines that start with a  string passed to it as an argument in the file  which is also passed as an argument and outputs the
whole line. This is similar to following grep command
grep ^"search sting" "file name" 

For eg if we have file named "one" with the contents

The weather has been cloudy
hence it is getting colder every day. 
It might rain too. 


If we want to search for lines that start with string "The" .

$ look The one 
The weather has been cloudy

By default "look" is case sensitive, to ignore case we can use an option "-f".

$look -f the one 
The weather has been cloudy

No comments:

Post a Comment