[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Eureka;/ Re: Editing a piped in stream?



On 07/07/2018 08:33 PM, David Wright wrote:

On 07/06/18 09:17, Richard Owlett wrote:
Subject line is poorly phrased.
While working on a problem {solved by a different approach} I had:
     ls -l /dev/disk/by-label/ | cut -f 10,12 -d ' ' > data.txt
I would then manually edit data.txt by replacing the space
character between the two fields with a tab.
I suspect I should be able to do:
     ls -l /dev/disk/by-label/ | cut -f 10,12 -d ' ' |
*something* > prettydata.txt
What you want is a tool that can handle fields delimited by one
or more whitespace characters.  Regular expressions come to
mind, but RTFM cut(1) doesn't look promising:
 [snip]

One might assume the OP wants something like

$ lsblk -l -o NAME,LABEL,MOUNTPOINT
NAME     LABEL       MOUNTPOINT
sda
sda2     SYSTEM_DRV
sda3     LRS_ESP
sda4
sda6     swan06      /
sda7     swan07      /wrenbk
sda10    swan10      [SWAP]
swanhome             /home


One might assume correctly :!
It even pretty prints the way I prefer.
That it can be sorted on a column is a bonus.
*THANK YOU*





Reply to: