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

Re: awk not just using the Field separator as such. it is using the blank space as well ...



On Mon, Feb 20, 2023 at 09:12:08PM +0000, Albretch Mueller wrote:
>  However this would rightly split that line based on the pipe delimiter:
> 
> $ echo "${_PTH}" | awk -F '|' '{for (i=1; i<=NF; i++) print $i;}'
> 83847547
> 2
> dli.ernet.449320/449320-Seduction Of The Innocent_text.pdf

So you're just converting pipelines to newlines?  You can do that with
tr.

tr '|' '\n'

>  There should be a sane way ;-) to feed those three lines into a bash array.

mapfile -t myarray < <(...)

But calling multiple processes just to split *one* line of input
is rather inefficient.


Reply to: