Hello to all,
I'm new to perl, I have input file that contains the string below:
315350535ff450000014534130101ff4500ff45453779ff450ff45545f01ff45ff453245341ff4500000545000
This string has as line separator "ff45". So, I want to print each line but the code below is not working.
perl -pe '
local $/;
$/ = "ff45";
while (<FILE>){
print;
}' file
If the only condition is set as line separator "ff45", the output would be:
315350535ff45
0000014534130101ff45
00ff45
453779ff45
0ff45
545f01ff45
ff45
3245341ff45
00000545000
But when the line length is less than 7 I want to concatenate that small line with the next one,
So, the final output I'd like to get is below (red part is small line, in blue next line):
315350535ff45
0000014534130101ff45
00ff45453779ff45
0ff45545f01ff45
ff453245341ff45
00000545000
May you help me in how to get this.
PS: If possible, I'd like only to modify the code inside the while loop, since I want to incorporate as part of a bigger script.
Thanks in advance.