On Tue, Jul 14, 2020 at 03:04:38PM +0200, Alex Mestiashvili wrote: > Since you anyway use tools like awk or tr, here is the perl code: > > echo " 34 + 45 \| abc \| 1 2 3 \| c\|123abc " | perl -F'\\\|' -lanE 'say > "\"".$_."\"" for @F'
If you're going to call on perl to help split the string into an array, you might as well throw bash away and write the entire program in perl instead.