Quantcast
Channel: Active questions tagged bash+awk - Ask Ubuntu
Viewing all articles
Browse latest Browse all 102

Replace a text within single quotes with another string using sed(just a first occurrence of regex)

$
0
0

I have a file with the following content:

$ cat file.txtCREATE COLLATION public.collation123 (provider = libc, locale = 'fr-FR');  CREATE COLLATION public.collation_1 (provider = libc, locale = 'bas');  CREATE COLLATION public.collation_test (provider = libc, locale = 'fr-FR');   

I want to replace the first occurrence of locale = 'fr-FR' with locale = 'fr_FR.utf8'.

After replacing, the file should have the following content:

$cat file.txtCREATE COLLATION public.collation123 (provider = libc, locale = 'fr_FR.utf8');  CREATE COLLATION public.collation_1 (provider = libc, locale = 'bas');  CREATE COLLATION public.collation_test (provider = libc, locale = 'fr-FR'); 

Viewing all articles
Browse latest Browse all 102

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>