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

2023-02-21 Thread Steve McIntyre
lbrt...@gmail.com wrote: >On 2/21/23, Greg Wooledge wrote: >> I have a funny feeling Albretch might be using Microsoft file systems >> (FAT, NTFS) for a large chunk of his system. Those have a much larger >> set of restricted characters. > > Certainly not FAT32 and definitely not FAT, but at work

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

2023-02-21 Thread Albretch Mueller
On 2/21/23, Greg Wooledge wrote: > I have a funny feeling Albretch might be using Microsoft file systems > (FAT, NTFS) for a large chunk of his system. Those have a much larger > set of restricted characters. Certainly not FAT32 and definitely not FAT, but at work (I work as a Math teacher and

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

2023-02-21 Thread Greg Wooledge
On Tue, Feb 21, 2023 at 05:19:13AM +, Tim Woodall wrote: > On Mon, 20 Feb 2023, Albretch Mueller wrote: > > > On 2/15/23, Greg Wooledge wrote: > > > > The reason why I use pipes as field delimiter is because it is an > > excellent meta character when you are working with filesystems. Pipes >

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

2023-02-20 Thread Tim Woodall
On Mon, 20 Feb 2023, Albretch Mueller wrote: On 2/15/23, Greg Wooledge wrote: The reason why I use pipes as field delimiter is because it is an excellent meta character when you are working with filesystems. Pipes would not accepted for files or directory names for good reasons, anyway. tim

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

2023-02-20 Thread Greg Wooledge
On Mon, Feb 20, 2023 at 09:12:08PM +, 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

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

2023-02-20 Thread Albretch Mueller
Thank you! I noticed my mistake and yes, once again it was a hack which I thought to be a typo. I had removed the pipe you had included in the last part of the input string!: "${_PTH}|" _PTH="83847547|2|dli.ernet.449320/449320-Seduction Of The Innocent_text.pdf" IFS="|" read -ra _PTH_AR <<< "${_P

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

2023-02-20 Thread Greg Wooledge
On Mon, Feb 20, 2023 at 07:24:01PM +, Albretch Mueller wrote: > > https://mywiki.wooledge.org/BashPitfalls#pf47 > > > what I am trying to do is split a string using as delimiter a pipe The web page you cited tells you how, doesn't it? Assuming your string is a line (e.g. something you pulled

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

2023-02-20 Thread Albretch Mueller
> https://mywiki.wooledge.org/BashPitfalls#pf47 > what I am trying to do is split a string using as delimiter a pipe. I used to do that with awk, but it doesn't work anymore after someone had the great idea of substituting awk with mawk, it seems; and Hey! They could have done it with python!: $

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

2023-02-20 Thread Greg Wooledge
On Mon, Feb 20, 2023 at 07:10:11AM +, Albretch Mueller wrote: > On 2/15/23, Greg Wooledge wrote: > > If you want to read FIELDS of a SINGLE LINE as array elements, use > > read -ra: > > > > read -ra myarray <<< "$one_line" > > It didn't work. I tried different options. I am getting: "bash: r

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

2023-02-19 Thread Albretch Mueller
On 2/15/23, Greg Wooledge wrote: > If you want to read FIELDS of a SINGLE LINE as array elements, use > read -ra: > > read -ra myarray <<< "$one_line" It didn't work. I tried different options. I am getting: "bash: read: ... : not a valid identifier" _PTH="83847547|2|dli.ernet.449320/449320-Se

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

2023-02-15 Thread Greg Wooledge
On Wed, Feb 15, 2023 at 12:09:28PM +, Albretch Mueller wrote: > On 2/15/23, DdB wrote: > > $ echo "Adams, Fred, and Ken Aizawa \"The Bounds of Cognition\"" | awk > > -F'\"' '{for (i=1; i<=NF; i++) print $i;}' > > Adams, Fred, and Ken Aizawa > > The Bounds of Cognition > > yes and this also w

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

2023-02-15 Thread Albretch Mueller
On 2/15/23, DdB wrote: > $ echo "Adams, Fred, and Ken Aizawa \"The Bounds of Cognition\"" | awk > -F'\"' '{for (i=1; i<=NF; i++) print $i;}' > Adams, Fred, and Ken Aizawa > The Bounds of Cognition yes and this also works: _L="Adams, Fred, and Ken Aizawa \"The Bounds of Cognition\"" echo "${_L}"

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

2023-02-15 Thread David
On Wed, 15 Feb 2023 at 18:22, DdB wrote: > Am 15.02.2023 um 07:25 schrieb Albretch Mueller: > > $ _L="Adams, Fred, and Ken Aizawa \"The Bounds of Cognition\"" > > echo "// __ \$_L: |${_L}|" > > _AR=($(echo "${_L}" | awk -F'\"' '{for (i=1; i<=NF; i++) print $i}' )) > > _AR_L=${#_AR[@]} > > echo "/

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

2023-02-14 Thread DdB
Am 15.02.2023 um 08:21 schrieb DdB: > $ awk --version > GNU Awk 4.2.1, API: 2.0 (GNU MPFR 4.0.2, GNU MP 6.1.2) > Copyright © 1989, 1991-2018 Free Software Foundation. even mawk would. see: $ mawk -W version compiled limits: max NF 32767 sprintf buffer 2040 $ echo "Adams, Fred, a

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

2023-02-14 Thread DdB
Am 15.02.2023 um 07:25 schrieb Albretch Mueller: > $ _L="Adams, Fred, and Ken Aizawa \"The Bounds of Cognition\"" > echo "// __ \$_L: |${_L}|" > _AR=($(echo "${_L}" | awk -F'\"' '{for (i=1; i<=NF; i++) print $i}' )) > _AR_L=${#_AR[@]} > echo "// __ \$_AR_L: |${_AR_L}|" > for(( _IX=0; _IX<${_AR_L};

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

2023-02-14 Thread Albretch Mueller
Once again one of my silly problems ;-). I search and search for an answer/the reason why this is happening. $ _L="Adams, Fred, and Ken Aizawa \"The Bounds of Cognition\"" echo "// __ \$_L: |${_L}|" _AR=($(echo "${_L}" | awk -F'\"' '{for (i=1; i<=NF; i++) print $i}' )) _AR_L=${#_AR[@]} echo "// _