Alfred’s Computing Weblog

Alfred Java-cored Computing Weblog

Linux | Find string in files

leave a comment »

I am trying to search for a string from the XML files (yup, more than an XML file)

I use grep with option “-an” which will print out the file name and line number of the found string.
The command below will search for text “my text” from all XML files in my current working directory.

grep -an "my text" *.xml

15 Practical GREP, resource

Written by Alfred

August 17, 2011 at 14:58

Posted in linux

Tagged with , , ,

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: