没有换行的cat文件 [英] cat file with no line wrap

查看:52
本文介绍了没有换行的cat文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在* nix中,如何显示(不显示)没有换行符的文件:应剪切更长的行使其适合屏幕宽度.

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.

推荐答案

请注意, cut 接受文件名作为参数.

Note that cut accepts a filename as an argument.

这似乎对我有用:

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.

这篇关于没有换行的cat文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆