Issue
In *nix, how do I display (cat) a file with no line-wrapping: longer lines should be cut such that they fit into screen's width.
Solution
Note that cut
accepts a filename as an argument.
This seems to work for me:
watch 'bash -c "cut -c -$COLUMNS file"'
For testing, I added a right margin:
watch 'bash -c "cut -c -$(($COLUMNS-10)) file"'
When I resized my terminal, the truncation was updated to match.
Answered By - Dennis Williamson Answer Checked By - David Marino (WPSolving Volunteer)