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.
How to handle “cannot refer to an open group at position” in Python?
How to format the output of a grep with a regex pattern to match between a string and character
Regular expression to match a line containing only the list of words
How do I create a regex for 2 different patterns that outputs in 1 group, in Google sheets?
Replacing a string in between known strings over mutiple lines in Powershell
Data Preperation Identify String using Regex and move to new column
Regular expressions - optional brackets
ICU Regex matching for non-digit and no whitespace
Seemingly incorrect regex evaluation in regexp_replace
How to detect a string which does not include " using flex?
Extract certain values from string in .txt files with PowerShell
Apache 301 Redirect Add language prefix if not present
Regex, match characters and doesn't contain more than one _ followed by another _
Regex ignore word
Regex not valid in google sheets error?
extract substring using regex in shell script