cat file.txt
...Some random string...
...String random string...
service_account_file = $HOME/easyclone/accounts/1.json
...Some random string...
...Some random string...
I just need to substitute the end part of line 3 ( 1 in this case , ie the number before string .json) with the value of a predefined variable
rjc1=999 && sed -i "3s/*\.json/$rjc1\.json/" file.txt
I tried the above command intending to replace 1.json by 999.json but it doesn't seem to work
Expected result with the above variable value
...Some random string...
...String random string...
service_account_file = $HOME/easyclone/accounts/999.json
...Some random string...
...Some random string...
Can anyone please help me to fix this small issue
Note :
- i didn't simply substitute 1.json in file.txt because it could be any random number originally in file.txt.
- Also didn't used global substitution as i need to substitute value in particular line only