dirtdog has asked for the wisdom of the Perl Monks concerning the following question:
Hi Monks
I have a small script that works, but it would be ideal if I could convert it to a one-liner. The objective is to return the unique values in the {108: tag. So in the example provided 8480963411 and 8481963413 would be returned and stored as 2 separate values in a Shell variable. Not sure it can be done, but thought I'd check with the Monks.
#!/usr/bin/env perl use strict; use warnings; $/ = "{S:{CON:}}"; while (<DATA>) { if ( /\{108\:(\w+)\}\}/ ) { print "$1\n"; } } __DATA__ {1:6392495900}{4:{177:1807300738}{451:1}{405:K22005}{108:8480963411}}{ +1:6392495900}{2:IVSN}{3:{108:8480963411}}{5:{MAC:00000000}{CHK:9F11}} +{S:{CON:}}${1:6392495903}{4:{177:1807300738}{451:1}{405:K22005}{108:8 +481963413}}{1:6392495903}{2:IVSN}{3:{108:8481963413}}{5:{MAC:00000000 +}{CHK:12846}}{S:{CON:}}
I appreciate any and all help
Thanks
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: One Liner
by kcott (Archbishop) on Nov 09, 2018 at 18:58 UTC | |
by dirtdog (Monk) on Nov 09, 2018 at 19:25 UTC | |
|
Re: One Liner
by LanX (Saint) on Nov 09, 2018 at 18:47 UTC |