-1

How do I edit command pr

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

so that the output looks like this:

 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

and not like this:

 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
wjandrea
  • 28,235
  • 9
  • 60
  • 81

2 Answers2

1

Don't use -s ' ' if you don't want the columns to separated by a single space.

As an aside, don't use upper case for your private variables.

tripleee
  • 175,061
  • 34
  • 275
  • 318
0

You should replace space to tab with tr, before you do nl

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

And that will tidy up the spaces for you

DXH30
  • 11
  • 4