Bash script to remove line breaks?
Try doing this:
echo $(cat $1)
I found this relevant answer in stackoverflow:
https://stackoverflow.com/questions/1251999/sed-how-can-i-replace-a-newline-n
The quickest way appears to be using tr:
tr '\n' ' ' </your/file
or for your example:
cat `find $HOME '$1"` | tr '\n' ' '
To learn more about the tr
command do, of course, man tr
.
The stackoverflow anser contains ways to do this with sed (would have been my first choice, but sed is very line-oriented and getting it to not interpret line breaks as field delimiters is arcane) and a way using read and bash, close to your initial approach.