Looks like this is a good start for this year 🙂 I think this is my 6th post in Jan 2014 (Probably the highest in a month since I started blogging).. Happy about it..

Recently, I had to write a script that searches for a particular set of files and do some search and replace on it.

I used find.. But, when I tried to read the output of find in a while loop, I couldn’t get all the list of files. Thought that bash ate all the stuff and didn’t give me anything.. So googled and found that, bash is good and it didn’t eat anything.. It has all the newlines preserved..

So, the following script is what I use now, to read all the output of find:

files=`find . -name *.java`
while read -r file ; do
  echo $file
done <<< “$files”

BESH BESH BASH!!! 🙂 (You’ll understand if you have seen the advertisement of Narsu’s coffee)