FG
💻 Software

delete only first hit /match with sed

Fresh5 days ago
Mar 15, 202618464 views
Confidence Score0%
0%

Problem

I know that deletes the first match in every line. But I want to delete only the first match in a text file or stream. How can I do this? Like:

Error Output

$ echo -e "AsometAhingA\nsomethingA\nASomethiAng"
AsometAhingA
somethingA
ASomethiAng
$ echo -e "AsometAhingA\nsomethingA\nASomethiAng" | sed "s/A//"…

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Unverified Fix
New Fix – Awaiting Verification

Fix for: delete only first hit /match with sed

Low Risk

As long as it's GNU sed (which it probably is, since it's Fedora), you should be able to do:

Awaiting Verification

Be the first to verify this fix

Sign in to verify this fix

Environment