---
type: link
tags: [public]
created: 2025-10-27T09:17:57.483Z
---# sed | Replace text only on lines matching a pattern.

**URL:** [https://www.gnu.org/software/sed/manual/sed.html](https://www.gnu.org/software/sed/manual/sed.html)

sed | Replace text only on lines matching a pattern. sed '/pattern/s/old_text/new_text/g' file.txt


---
**Keywords:** public
