sd icon indicating copy to clipboard operation
sd copied to clipboard

How to replace if the string is on a certain line number?

Open blueray453 opened this issue 4 years ago • 2 comments

How to replace if the string is on a certain line number? For example, Replace foo with bar only on the 4th line. in sed the command looks like: sed -i '4s/foo/bar/g' file

blueray453 avatar Sep 07 '21 07:09 blueray453

Did you find any solution to this, going through the repository I do not think this is implemented right?

cenk1cenk2 avatar Feb 02 '22 16:02 cenk1cenk2

Unfortunately no. However, you can replace a line in a file using:

sudo sd "<U005F> IGNORE;IGNORE;IGNORE;<U005F> % LOW LINE" "<U005F> <RES-2>;IGNORE;IGNORE;<U005F> % LOW LINE" /usr/share/i18n/locales/iso14651_t1_common

blueray453 avatar Feb 03 '22 04:02 blueray453