Using Bash Regular Expressions to replace part of matched results
I have a file with lines that appear as: 1/foo/bar/ 2/foo/bar/ 3/foo/bar/ I would like to take two inputs, the first of which to match to the number. This is relatively simple. Then, I'd like to replace 'bar' with whatever is input for the second argument. Is this possible?
This smells like a homework assignment, but anyway, if you're on Linux (bash) "sed" should be available to match a line and do a replacement in that line, otherwise passing through non-matching lines unchanged.
regex from first character to the end of the string
How can I recognize the following group of strings using a grammar or regex?
htaccess redirect begins with
grep through binary file
Printing Text on Perl with RegEp
Regexp for substitution of anything other than numbers and 'N/A'
This regex is inefficient. Why does it crash Sublime Text 2's stack?
Posix regex in Postgresql to extract from quoted text?
Regular expression sequence matching
Perl change number to words
regex to match value up to 2 decimal
What is the mappings.ts file and how should it be set up in Tritium?
Symfony2 IBAN Validator returns false for valid UK IBAN
Regex to find anchor tags which are without http or https in the href attribute
What's the difference between [:space:] and [:blank:]?
Regex to replace   with