Bash function for finding & editing content
fixwhere()
{
files=\((grep -ril "\){1}” *)
if [ -n “\(files" ]; then<br /> vim +/"\){1}” \({files}<br /> else<br /> echo "not found: [\){1}]“
fi
}
I use this whenever I have a bunch of text files. It’s especially handy when you’re working with a markup language.
I specifically wrote it to use ‘vim’ and the +/pattern function. I don’t actually know a good way to have it load any ${EDITOR} you use and search for the pattern in that editor.
I suppose if the time comes and I need to generalize, I will write a load_search_and_edit() function. For now, it works for me and makes me happy.
Cheers.