Sed to delete multiple lines starting with match of pattern1 then potentially multiple matches of pattern2 (greedy)
I want to use Sed to delete blocks of lines form a file, when first line matches pattern1 then continue deleting next lines until does NOT match pattern2 (or EOF), where pattern1 and pattern2 may or may not have overlap.
Sed to delete multiple lines starting with match of pattern1 then potentially multiple matches of pattern2 (greedy)
I want to use Sed to delete blocks of lines form a file, when first line matches pattern1 then continue deleting next lines until does NOT match pattern2 (or EOF), where pattern1 and pattern2 may or may not have overlap.
How to use sed to replace multiple numbered characters per line?
I know how to modify one character per line with a new character, here the 3rd character is being replaced in every line:
I want to change all matching tmp_[1] to tmp__1_ using sed in a file
I want to change all matching tmp_[1]
to tmp__1_
using sed
in a file. The number 1
can be any number of digits and [
has to be changed to -
using sed
all occurrences have to be changed
sed command OR operator not working in a group [duplicate]
This question already has answers here: Regex not working with sed (5 answers) Closed 16 days ago. I’m running on MacOS. I have a file which contains these lines: This is (‘apple’). This is (‘orange’). This is (‘banana’). When I search for an apple using sed it works: cat file.txt | sed -n “/((‘apple’)/p” But […]
Remove last character of first word
I want to remove the last character from the first word in a stream of strings using sed, e.g., 20240801T00:48
should become 20240801T00:4
. I’ve tried
Unix error “Invalid RangeEnd” using sed on OracleLinux8.9 – code works onOL 7.9
I amfacing an error working with sed on files.
We have this core running successfully on OracleLinux 7.9 but onOracleLinux 8.9 the same code fails with invalid range end
multiple lines selection in sed with custom delimiter, why do I need to escape twice?
What I want to do I want to parse a file to remove all lines before and after given patterns A and B (excluding pattern A and B). I also want to use a custom delimiter instead of /. What I tried Deleting lines Inspired by this question, the following does give the expected output […]
Deleting first comment in C source file using sed
I would like to remove the first C block comment from the top of every file (recursively). To start with, I’m happy to just strip the first comment (wrapped in /* and */) from the top of a single file.
Deleting first comment in C source file using sed
I would like to remove the first C block comment from the top of every file (recursively). To start with, I’m happy to just strip the first comment (wrapped in /* and */) from the top of a single file.