After viewing a file in
less, with the convenience of scrolling to the side and searching, I want to be able to view/copy the contents of that file normally in my terminal window without having to run
cat on it.
-X option, the output of
less is not cleared from the screen after exiting, but anything beyond the right boundary of the window is truncated, and a lot of junk for showing the scrolling gets left behind.
Is there a one-liner or option that would leave behind
cat-like output after exiting
The closest I got was with
cat foo.txt | tee >(less), which gives me a hard time when trying to quit
cat foo.txt | tee /dev/tty | less works even better than that, but when I use it as a pager in MySQL, it tends to cut off short of printing the whole result table.