Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/bash/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Bash Shell命令pr_Bash_Shell_Sorting_Unix_Tr - Fatal编程技术网

Bash Shell命令pr

Bash Shell命令pr,bash,shell,sorting,unix,tr,Bash,Shell,Sorting,Unix,Tr,如何编辑命令pr tr [:upper:] [:lower:] < "${FILE}" | tr -d [:digit:] | sort | pr -s' ' -t3 | nl 不是这样的: 1 bcxwhex jbdafn osnu 2 bijly jdofnx uriqcl 3 btgr jz uztyp 4 bwifmn kfaky wfwdz 5 bxgvs kigdo wgdax 6 cfukt

如何编辑命令pr

tr [:upper:] [:lower:] < "${FILE}" | tr -d [:digit:] | sort | pr -s' ' -t3 | nl
不是这样的:

 1  bcxwhex jbdafn  osnu
 2  bijly   jdofnx  uriqcl
 3  btgr    jz      uztyp
 4  bwifmn  kfaky   wfwdz
 5  bxgvs   kigdo   wgdax
 6  cfukt   lf      wgfil
 7  cgyqlp  lnccknh ypt
 8  eocbm   njevos  zcplnln
 9  hgmbc   ocndbmr znknpo
10  iawmkbh opder   zyezfq
 1  bcxwhex jbdafn osnu
 2  bijly jdofnx uriqcl
 3  btgr jz uztyp
 4  bwifmn kfaky wfwdz
 5  bxgvs kigdo wgdax
 6  cfukt lf wgfil
 7  cgyqlp lnccknh ypt
 8  eocbm njevos zcplnln
 9  hgmbc ocndbmr znknpo
10  iawmkbh opder zyezfq

在执行nl之前,应该用tr替换tab的空格

tr [:upper:] [:lower:] < "${FILE}" | tr -d [:digit:] | sort | pr -s' ' -t3 | tr ' ' \\t| nl
tr[:upper:][:lower:][“${FILE}”tr-d[:digit:][sort | pr-s'-t3 | tr'\\t | nl

这将为您整理空间

如果您不希望列之间用单个空格分隔,请不要使用
-s'


另一方面,

通过管道将其传输到
列-t
如果列在实际文本中包含空格,则会弄乱格式。