Match the first occurrence

Jul 20, 2022 12:40


Выдать первое соврадение, с помощьё GNU sed.

sed -n '/RE/{p;q;}' file # print only the first match
sed '0,/RE/{//d;}' file # delete only the first match
sed '0,/RE/s//to_that/' file # change only the first match

sed, bash

Previous post Next post
Up