I have a problem, I have a file test.txt that has a content like this:
objectClass: CPM1
objectClass: CPM2
objectClass: CPM3
objectClass: CPM4
objectClass: CPZ
objectClass: CP04s
objectClass: CP0A
objectClass: CP11
entryDS: 1
nodeId: 21
createTimestamp: 20211014155438Z
modifyTimestamp: 20220313041228Z
MSISDN: 353834079137
IMSI: 272050103105233
NAM: 0
CDC: 1423
IMEISV:: U1RQJgAkQiE=
AUTHINFO: 0
CSP: 11
SUBSCSPVERS: 20
RSA: 20
SUBSRSAVERS: 19
APNID1: 4
Every time the text IMEISV:: is found I want to replace in that file the value after IMEISV:: (in this case U1RQJgAkQiE=) with the result of the following function:
base64 -d | od -t x8 -An | rev
If I do in unix an echo would be like this:
echo U1RQJgAkQiE= | base64 -d | od -t x8 -An | rev
The result would be 3545056200422412
So at the end in the file, the value U1RQJgAkQiE= should be 3545056200422412. Like this:
objectClass: CPM1
objectClass: CPM2
objectClass: CPM3
objectClass: CPM4
objectClass: CPZ
objectClass: CP04s
objectClass: CP0A
objectClass: CP11
entryDS: 1
nodeId: 21
createTimestamp: 20211014155438Z
modifyTimestamp: 20220313041228Z
MSISDN: 353834079137
IMSI: 272050103105233
NAM: 0
CDC: 1423
IMEISV:: 3545056200422412
AUTHINFO: 0
CSP: 11
SUBSCSPVERS: 20
RSA: 20
SUBSRSAVERS: 19
APNID1: 4
Can someone please let me know how to do it with sed/perl...? I'm really a newbie with unix