× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Hello Arnie,

Am 13.10.2020 um 00:11 schrieb Arnie Flangehead <arnie.flangehead@xxxxxxxxx>:

I can't get the inline method to work.

cat infile.txt |sed '/^ONE IS NICE$/i TWO IS NICER' > outfile.txt

sed: 001-2263 Error in file "/^ONE IS NICE$/i TWO IS ..." on line 1:
command i expects a backslash followed by text.

Yap, then you're coping with an ancient implementation of sed. Probably the same issue I struggled with, years ago.

But the error message should give you a clue: Sed expects a *literal* backslash with a newline afterwards. So, the Backslash is not to be interpreted by the shell itself! And the newline must be maintained. Now, this is really PITA in an interactive shell (but possible, at least with newer stuff).

You're clearly leaving leaving ground for trying sed on the command line to be doing what you want it to do. Either do it in a shell script file, or with a commands file, as pointed out earlier.

:wq! PoC

PGP-Key: DDD3 4ABF 6413 38DE - https://www.pocnet.net/poc-key.asc



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.