Last Updated: February 25, 2016
·
468
· soldiercoder

"Find"ing stuff!

Find is a GREAT tool.

While checking out someone else's rails I could not remember where I had seen a particular path name. So I whipped out my Find work-horse.

find app/views -exec grep -n new_user_registration --with-filenane {} \;

and I get a very nice line that tells me where it is and where it is and what line number it is on:

app/views/layouts/header.html.erb:48: <%= formfor(:user, :url => new_user_registration_path(:format => :json),

Note the format -- the path, followed by the line number, followed by what's on the line, all seperated by colons. I'm sure a Sed or Gawk hacker could use that format to make a command that opens your editor to that file at that line number. I will leave that to you!