In *nix, how do I display (cat
) a file with no line-wrapping? Longer lines should be cut such that they fit into the screen width.
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.