alias_qr_rainmaker@lemmy.world to linuxmemes@lemmy.world · 2 天前Even better than the originallemmy.worldimagemessage-square12fedilinkarrow-up199arrow-down13
arrow-up196arrow-down1imageEven better than the originallemmy.worldalias_qr_rainmaker@lemmy.world to linuxmemes@lemmy.world · 2 天前message-square12fedilink
minus-squareh4x0r@lemmy.dbzer0.comlinkfedilinkEnglisharrow-up8·2 天前No sed necessary with extglob enabled: echo ${line//@(TH|[EL ]|DO)/}
minus-squareBadabinski@kbin.earthlinkfedilinkarrow-up3·2 天前I was waiting for someone to come along with this response lmao I’m terrible at remembering shell string operation syntax, but this is the ultimate answer.
minus-squaresik0fewl@lemmy.calinkfedilinkarrow-up2arrow-down1·2 天前Definitely not the ultimate, since it’s not POSIX, but still a nice tidbit.
minus-squareBadabinski@kbin.earthlinkfedilinkarrow-up3·2 天前Idk, writing POSIX-compliant shell is so miserable that I avoid doing it when I can. You can use Bash on BSD and all other unixes, so it’s still a relatively portable solution.
minus-squaresik0fewl@lemmy.calinkfedilinkarrow-up2arrow-down1·2 天前True enough, but it’s pretty much the same to use sed, unless you need those milliseconds of performance boost.
No
sednecessary withextglobenabled:echo ${line//@(TH|[EL ]|DO)/}I was waiting for someone to come along with this response lmao
I’m terrible at remembering shell string operation syntax, but this is the ultimate answer.
Definitely not the ultimate, since it’s not POSIX, but still a nice tidbit.
Idk, writing POSIX-compliant shell is so miserable that I avoid doing it when I can. You can use Bash on BSD and all other unixes, so it’s still a relatively portable solution.
True enough, but it’s pretty much the same to use sed, unless you need those milliseconds of performance boost.