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

Re: Editing a piped in stream?



On Jul 06, 2018 um 11:17:56, 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
> 
> I searched for examples/tutorials found that it should be conceptually
> possible. However the examples I found were processing streams I didn't
> understand.

Hello Richard,

one way is to do it with sed:

ls -l /dev/disk/by-label/|cut -f 10,12 -d ' '|sed 's/ /\t/g'>prettydata.txt

Hth Michael

Attachment: signature.asc
Description: PGP signature


Reply to: