Re: Nice easy sed question
- In reply to: Frank Leonhardt : "Nice easy sed question"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 12 Sep 2025 06:37:11 UTC
On Thu, 11 Sep 2025 23:14:50 +0100
Frank Leonhardt <freebsd-doc@fjl.co.uk> wrote:
> Or is there a better utility for editing (non-system) configuration
> files by script I just don't know about?
I tend to find awk is more flexible for these things, but I avoid any
GNU and BSD extensions so the scripts remain portable.
$ cat << 'EOF' | awk '{print} $0=="Line 2" {print "New Line"}'
Line 1
Line 2
Line 3
EOF
Line 1
Line 2
New Line
Line 3