ggupta
ggupta

Reputation: 59

replace null to ""test"" in a file using unix

I have below pattern in my file at different lines

""key"": null

I want to replaceu this to

""key"": ""test""

through linux

i used the below commands:

sed -i 's/ null / ""test"" /'
sed -i 's/ null / \"\"test\"\" /'

but failed.

Upvotes: 0

Views: 328

Answers (1)

vim_
vim_

Reputation: 2170

This should do it:

 sed -i 's/null/\"\"test\"\"/g' file.txt

Upvotes: 1

Related Questions