I use the command:
tr '\n' ' ' < input.txt > output.txt
to convert new lines to spaces using tr
command.
It works fine for single files - but I have multiple files I need to run a single command on... similar to the following command for doing text swapping:
find /directory/. -type f -exec sed -i 's/oldtext/newtext/g' {} \;
Is there a command I can add to a bash script (like the one above using find) to remove \n
?