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).
Given a certain regex pattern, re-arrange and manipulate the contents of a cell
Regular expression“\\|” in strsplit
Parsing sectioned file with augeas
I need search a pattern in a header line of my file and concatenates the next line with Perl
Regular Expression statement to replace text inside two literals
RegEx pattern with not followed by
How to pull words based on positioning from a text element using Regex?
Remove C/C++, Multiline comments from a array in which file is read
Regexp match time expression (mmmm:ss)
How do I create a regex in Emacs to capture text between double square brackets?
How to set a RegExp to have a real matching judgement?
Editing a line of a configuration file from shell
Perl replace the top-level numbers only from a tree
Regular Expressions match exactly 7 or 9 digits
How to accept numbers and specific words?
Javacc regular expression that matches all string except certain ones