i have file already converted into base64 format
JEZpbGVOYW1lID0gIkQ6XExvZ3MtRlRQMDFcRW5jb2RlTG9naWMudHh0IgoKIyBHZXQgY29udGVudCBvZiB0aGUgZmlsZQokRmlsZUNvbnRlbnQgPSBHZXQtQ29udGVudCAkRmlsZU5hbWUKCiNHZXQgdGhlIGJ5dGVzIG9mIHRoZSBmaWxlIGNvbnRlbnQgd2l0aCBlbmNvZGUKJGZpbGVDb250ZW50SW5CeXRlcyA9IFtTeXN0ZW0uVGV4dC5FbmNvZGluZ106OlVURjguR2V0Qnl0ZXMoJEZpbGVDb250ZW50KQoKIyBCYXNlNjQgRW5jb2RlIGZpbGUgCiRmaWxlQ29udGVudEVuY29kZWQgPSBbU3lzdGVtLkNvbnZlcnRdOjpUb0Jhc2U2NFN0cmluZygkZmlsZUNvbnRlbnRJbkJ5dGVzKQoKCgoKIyBTYXZlIEJhc2U2NCBFbmNvbmRlIGZpbGUgd2l0aCBleHRlbnNpb24gLmI2NAojJGZpbGVDb250ZW50RW5jb2RlZCB8IFNldC1jb250ZW50ICgkZmlsZU5hbWUgKyAiLmI2NCIpCgojV3JpdGUtSG9zdCAkRmlsZU5hbWUgKyAiLmI2NCIgKyAiRmlsZSBFbmNvZGVkIFN1Y2Nlc3NmdWxseSEiCg==
now i want to select every 30 char follow by dot and create new line in powershell like example below
c3VkbyBkb2NrZXIgcnVuIC1kIFwgwq.
DCoC0tbmFtZSBibG94Lm5vYSBcIMKg.
wqAtLW5ldHdvcms9aG9zdCBcIMKgwq.
AtdiAvdmFyL3J1bi9kb2NrZXIuc29j.
azovdmFyL3J1bi9kb2NrZXIuc29jay.
BcIMKgwqAtdiAvdmFyL2xpYi9pbmZv.
YmxveC9jZXJ0czovdmFyL2xpYi9pbm.
ZvYmxveC9jZXJ0cyBcIMKgwqAtdiAv.
ZXRjL29ucHJlbS5kLzovZXRjL29ucH.
JlbS5kLyBcIMKgwqBpbmZvYmxveGN0.
by9vbnByZW0uYWdlbnQ6djQuMS41IF.
wgwqDCoC0tam9pbnRva2VuPWh4YlFo.
YXcxa2M2MFpKV3JYdzNOU1pUdVExMD.
dZSFU2aGpaVUxfQngwWXJu.
in bash it can be done using awk like below
base64 filename | awk '{for(i=1;i<length;i =100) print substr($0,i,100) "."}'
Thanks
CodePudding user response:
$Base64 -Replace '(.{30})', "`$1.`r`n"