Using BSD sed (no GNU extensions), how can I perform an operation similar to the example provided below, but where instead of the line number, the replacement is performed on the first line in which a pattern occurs (rather than having to specify an actual number)?
Restricting to a line number
The simplest restriction is a line number.
If you wanted to delete the first number on line 3, just add a "3" before the command:
sed '3 s/[0-9][0-9]*//' <filename >newfilename
Best Answer
^should work w/ a BSD
sed
. but apparently it doesn't.and so:
...should work with any of them.