控制字符
, col 就可以移除掉,我不知道对不对网上看来的,有其它好方法求赐教,比如 man find >m-find.txt
或者 `tree -L 1 >tree-1.txtNAME
col -- filter reverse line feeds from input
SYNOPSIS
col [-bfhpx] [-l num]
DESCRIPTION
The col utility filters out reverse (and half reverse) line feeds so that the output is in the correct order with only forward and half forward line feeds, and replaces white-space characters with tabs where possible. This can be useful in processing the output of nroff(1) and tbl(1).
HISTORY
A col command appeared in Version 6 AT&T UNIX.
https://pubs.opengroup.org/onlinepubs/7908799/xcu/intro.html#tag_001_003_003
Legacy Utilities: col - filter reverse line-feeds (LEGACY)
https://github.com/karelzak/util-linux/blob/master/Documentation/col.txt
Fixed: tree -NL 2 ~ >tree-2.txt
man 的话,暂不知道,你比如说从 https://github.com/man-pages-zh/manpages-zh 随便找一个带中文的。macos man 查看失败。
1
ysc3839 2019-09-05 15:20:25 +08:00
|
2
gIrl1990 OP @ysc3839 `tree -L 2 ~ >tree-2.txt` 会报 `col: Illegal byte sequence` 错误,源码找不到 `Illegal` 字样,233
|
3
xml123 2019-09-05 16:45:18 +08:00
直接替换 ascii 小于 32 的字符不行吗
|
4
ysc3839 2019-09-05 17:33:59 +08:00
@gIrl1990
https://opensource.apple.com/source/xnu/xnu-4903.241.1/bsd/sys/errno.h.auto.html #define EILSEQ 92 /* Illegal byte sequence */ https://opensource.apple.com/source/Libc/Libc-1272.250.1/gen/errlst.c.auto.html "Illegal byte sequence", /* 92 - EILSEQ */ |
6
gIrl1990 OP 命令没写全,是
`man find | col -b >m-find.txt` `tree -L 2 ~ | col -b >tree-2.txt` |