💻 Software
How to left and right strip at the same time?
Fresh5 days ago
Mar 15, 20261382 viewsConfidence Score0%
0%
Problem
I use and to remove prefix and postfix of string. How can I do them at once instead of two.
Error Output
$ x=2012-hello.jpg
$ y=${x#*-}
$ z=${y%.*}
$ echo $z
helloUnverified for your environment
Select your OS to check compatibility.
1 Fix
Canonical Fix
Unverified Fix
New Fix – Awaiting Verification
Fix for: How to left and right strip at the same time?
Low Risk
It is not possible with parameter expansion, but it is possible with regular expression matching:
Awaiting Verification
Be the first to verify this fix
Sign in to verify this fix