Skip to content
Advertisement

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.

Advertisement

Answer

This should do it:

 sed -i 's/null/""test""/g' file.txt
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement