I need a good one-liner to look in a specific text file for a line of text and if it's not found, add it at the bottom of the file.
Perl, sed, not particular, whatever works. To make matters worse, the line of text is in a config script with lots of special characters and needs lots of escapes\.
Not really a one liner, but check if it works for you:
I created a txt file named test.txt and tried to look for the pattern aaaa = /export/home/@run.txt
Let me know if this serves your purpose...
regards,
Arun.
Or maybe...
pattmatch="aaaa = /export/home/@run.txt"
grep $pattmatch test.txt >/dev/null 2>&1 || echo $pattmatch >> test.txt
Jerry
Yours worked, Arun, I just had to add escapes for double qoutes within my added string. thanks!