samedi 28 octobre 2017

Bash pattern matching 'or' using ${}

hashrate=${line//*:/}
hashrate=${hashrate//H\/s/}

I'm trying to unify this regex replace into a single command,something like:

hashrate=${line//*:\+/H\/s/}

However, this last option doesn't work. i also tried with \|, but it doesn't seem to work and i haven't find anything useful in bash manuals and documentation. I need to use ${} instead of sed, even if using it solves my problem.

Aucun commentaire:

Enregistrer un commentaire