I use the MAC address of the machine as userid and would like to update a file (display.txt) that will display the userid/expiry. How do I replace the expdate in display.txt with the date in expdate.txt corresponding to the MAC address.
I succeed with the userid part, with:
sed -i "s/user/$(ifconfig eth0 |
grep -o -E '([[:xdigit:]]{2}:){5}[[:xdigit:]]{2}')/" \
/user/id/display.txt > /dev/null
display.txt:
UserID: user
User expiring on expdate
expdate.txt:
user = 00:09:34:2C:66:AB
expdate = 2017-05-20
user = 00:09:34:29:86:6C
expdate = 2017-08-23
I would like to have:
display.txt:
UserID: 00:09:34:29:86:6C
User expiring on 2017-08-23