Relative Content

Tag Archive for sed

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

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.