On 7/14/20 3:05 PM, Greg Wooledge wrote:
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.
That's what I usually do. IMHO bash scripting is awful in many ways,
insecure and plain dangerous :) Perl in this regard is way better.
However I see no point here, if you use awk or other tools, what's wrong
with perl oneliners?