Alfred’s Computing Weblog

Alfred Java-cored Computing Weblog

Posts Tagged ‘find

Linux | Find string in files

leave a comment »

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

Solution
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

Advertisements

Written by Alfred

August 17, 2011 at 14:58

Posted in linux

Tagged with , , ,