Replace a line in the file using sed, line has a moving portion in the center of it
There is a moving portion in the line. sed needs to search for a line that might have anything in the center of it. In other words we are looking to find this line by telling sed that it starts with aaa and ends with ccc the center could be anything. Let's say we have a file called a.txt, and this is what is in it. a b aaa111ccc sed needs to find the line that looks like.. aaa(.*)ccc And then replace it with "_TEST_" The output should be aaa_TEST_bbb
Which part do you need help with? sed 's/^aaa.*bbb$/aaa_TEST_bbb/' file >newfile If you want to edit the file in place, remove the redirection and add a suitable -i option (provided your sed supports it).
strip a regex character match from a string
Replacement within the matched string with sed
AHK - How to use dynamic hotstring with a barcode scanner
Fuzzy match on google sheets
VB Net RegEx Match Multiple
Invalid Escape Character in Regex for html 5 Input Validation
Regex to match start and end line [duplicate]
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