I’m in the process of rebuilding a database that has been corrupted, and part of this rebuild involves using grep via a simple bash script I’ve written to search for a string of around four words in length. This returns a file path, which I’d like to pipe directly into head so that I can view the first few lines of the file that grep has found.
However, while running sh search2.sh "these are some search terms" returns precisely one file path, running sh search2.sh "these are some search terms" | head doesn’t run head on that file. I’ve noticed that the file path that grep returns doesn’t escape spaces, but I don’t know if this will be a problem for head. Any ideas what I should try next?
try this:
this should resolve an issue with unquoted whitespace…