How to double digits using sed command in Unix?
I'm new to the Unix sed command and I would like to know how to double the first digit in a string? Suppose we have a string "F0o", How do I double the first digit in the string? I tried echo f0o | sed s/0/00/, giving f00o, but this will only work for 0s. If the string is "f12o" the output should be f112o, simply doubling the first digit in the string. Is there a command where I can specifically target digits only?
I would like to know how to double the first digit in a string You could say: sed 's/[0-9]/&&/' filename This would print the first digit in a line two times. $ sed 's/[0-9]/&&/' <<< "f12o" f112o
RegEx in perl that Uses Groups to Extract Information From A Filepath
nginx, redirect to remove a part of filename
How to grep the second number only in one line?
find first and last occurence of the matched string in perl
Regex select pattern
regular expression Pattern object getting converted to string if fetched from config.cfg file
Dynamically-created 'zip' command not excluding directories properly
Groovy regexes and wildcard permissions
Regular expression to verify a username
match an IP against a regular expression with CIDR range
Bash script - user inputs 2 digits seperated by a space; need to verify it's a digit
Using ampersand in sed
Remove all instances of sub-string after a different sub-string has occurred N times
How to replace “\” to “T” using regex?
parse text into sentences via regex
Regex for 9-digit phone number dot-separated