I have a range of .html files all containing spaces in between.
What I need is to locate the file using find in conjunction with grep, and if a match is found, basically I just want xargs to open it in view mode using less. Nothing fancy.
This is what I tried
pietro@scum:~/Downloads$ find |grep 'Register\sfor\srehousing.html' |xargs -trE less
echo ./Register for rehousing.html
./Register for rehousing.html
pietro@scum:~/Downloads$ find |grep 'Register\sfor\srehousing.html' |xargs -0 less
./Register for rehousing.html
: No such file or directory
I have gone through the xargs man but I just can't figure out why xargs doesn't pickup the filename + PATH to file and execute the less command.
The file does exist and here is how it looks
pietro@scum:~/Downloads$ ls -l |grep 'Register\sfor\srehousing.html'
-rw-rw-r-- 1 pietro pietro 764611 Mar 14 14:44 Register for rehousing.html
find -name
instead offind | grep
?less "Register for rehousing.html"
if you know the file exists?