Re: (question) fast split/join of strings

2024-09-17 Thread alex xmb sw ratchev
cool .. gotta do .. thxx n greets .. On Tuesday, September 17, 2024, Greg Wooledge wrote: > On Tue, Sep 17, 2024 at 17:00:16 +0200, alex xmb sw ratchev wrote: > > plz what does 'local -' do , its newer to me > > i forgot all about it already > >local [option] [name[=value] ... | - ] >

Re: (question) fast split/join of strings

2024-09-17 Thread Greg Wooledge
On Tue, Sep 17, 2024 at 17:00:16 +0200, alex xmb sw ratchev wrote: > plz what does 'local -' do , its newer to me > i forgot all about it already local [option] [name[=value] ... | - ] For each argument, a local variable named name is created, and assigned valu

Re: (question) fast split/join of strings

2024-09-17 Thread alex xmb sw ratchev
very respectable great email mate the set -f , ye i always missed it i gotta train me that more in the 1,2,,3 issue , id say thata valid cause ,, is literarly an empty field a second sep seems me great just as awk , one sep is for fields on a line , one is the per line sep set -f ; ss=$'\1\2' ss

Re: (question) fast split/join of strings

2024-09-17 Thread Greg Wooledge
On Tue, Sep 17, 2024 at 16:07:58 +0200, alex xmb sw ratchev wrote: > savedifs=${IFS@A} savedifs=${savedifs:- unset -v IFS } > str=1,2,3 IFS=, arr=( $str ) joined=${arr[*]} > eval "$savedifs" Using unquoted $str in an array expansion to do the splitting has a couple drawbacks: 1) Globbing (filenam

Re: (question) fast split/join of strings

2024-09-17 Thread alex xmb sw ratchev
in the printf to stdout a final printf \\n is missing greets On Tuesday, September 17, 2024, alex xmb sw ratchev wrote: > savedifs=${IFS@A} savedifs=${savedifs:- unset -v IFS } > str=1,2,3 IFS=, arr=( $str ) joined=${arr[*]} > eval "$savedifs" > > alternative middleline > > sep=, str=1$sep2$sep

Re: (question) fast split/join of strings

2024-09-17 Thread alex xmb sw ratchev
savedifs=${IFS@A} savedifs=${savedifs:- unset -v IFS } str=1,2,3 IFS=, arr=( $str ) joined=${arr[*]} eval "$savedifs" alternative middleline sep=, str=1$sep2$sep3 IFS=$sep arr=( $str ) joined=${arr[*]} ( at var=assignment , quotes dont matter , excepts to bind spaced code together as cmd or cmd

Re: (question) fast split/join of strings

2024-09-17 Thread Greg Wooledge
On Tue, Sep 17, 2024 at 02:56:05 -0400, Lawrence Velázquez wrote: > This question is more appropriate for help-bash than bug-bash. > > On Tue, Sep 17, 2024, at 2:21 AM, William Park wrote: > > For splitting, I'm aware of > > old="a,b,c" > > IFS=, read -a arr <<< "$old"

Re: (question) fast split/join of strings

2024-09-16 Thread Lawrence Velázquez
This question is more appropriate for help-bash than bug-bash. On Tue, Sep 17, 2024, at 2:21 AM, William Park wrote: > Hi all, > > Is there fast way of splitting and joining of strings in the recent Bash > versions? Define "fast". > For splitting, I'm aware of > old="a,b,c" > IFS=, re

(question) fast split/join of strings

2024-09-16 Thread William Park
Hi all, Is there fast way of splitting and joining of strings in the recent Bash versions? For splitting, I'm aware of old="a,b,c" IFS=, read -a arr <<< "$old" For joining, new=$(IFS=,; echo "${arr[*]}") or new=$(IFS=,; echo "$*")