Skip to content
Advertisement

Use sed with ignore case while adding text before some pattern

JavaScript

In this case,how to ignore case while searching for pattern =first

Advertisement

Answer

You can use the following:

JavaScript

Otherwise, you have the /I and n/i flags:

JavaScript

From man sed:

I

i

The I modifier to regular-expression matching is a GNU extension which makes sed match regexp in a case-insensitive manner.

Test

JavaScript
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement