'When executing a perl search and replace on the command line, how do I lower case a matched token?
I have a file with lines like
TEST=value
I would like to do a search and replace such that I replace the first token with its lower case equivalent. So the above would be transformed into
prefix/test —output value
I tried the below
perl -pi -e ’s/(.*)=(.*)/prefix\/lc($1) —output $2/g' .env
But evidently “lc” is being interpreted literally because the result is
prefix/lc(TEST) —output value
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
