I have a file test.txt which has a line like below
values = abc, def, dfg, ert, sdf, sfd, sdf
I use the shell script to add a new value with comma separation in the values in the test,txt.
For example, I need to add the 'ghf' in the test.txt:
values = abc, def, dfg, ert, sdf, sfd, sdf, ghf
Also I need to remove the value.
For example, if I need to remove the 'ert' in the test.txt:
values = abc, def, dfg, sdf, sfd, sdf, ghf
How can I achieve this in shell script?
(i.e)
If I give the
echo "abc" >> test.txt
It is able to append the "abc" to the end of the file but I need to append to the 'values=' field in test.txt
Thanks,
Hari
sed
which is the right tool for your requirementsed
which might be a better tool for your requirementert
? I don't see an example of how you'd expect to do that.