Hiro 714
asked on
shell script question
I would like to replace a string with a certain condition.
1. remove a string the 5-digit number after "customer pin =" and replace to #####
example: "customer pin = 12345" to "customer pin = #####"
1. remove a string the 5-digit number after "customer pin =" and replace to #####
example: "customer pin = 12345" to "customer pin = #####"
ASKER
Thank you.
this code does not work. would you adivse?
this code does not work. would you adivse?
sed 's/customer pin = \d{5}/customer pin = #####/'
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
sed, to me, doesn't work sensibly.
With sed you'll likely require using POSIX regular expressions.
The following works for me, with recent version of sed...
This is why I normally use PERL instead.
With sed you'll likely require using POSIX regular expressions.
The following works for me, with recent version of sed...
sed -ri 's/customer pin = [[:digit:]]{5}/customer pin = #####/g' foo.txt
This is why I normally use PERL instead.
Open in new window