in reply to Preserving "Valid" Data?
Assuming your SATID sections are all the same length.
#!/usr/bin/perl # http://perlmonks.org/?node_id=1186932 use strict; use warnings; while(<DATA>) { s/SATID.{21}(?:(SIGNAL ..)|.{9})/ $1 ? $& : ' ' x length $& /ge; print; } __DATA__ Timestamp: 00:55:46 SATID 17 VAL1 49 VAL2 038 SIGNAL 39 SATID 18 S +ATID 17 VAL1 49 VAL2 038 SATID 19 VAL1 69 VAL2 015 SIGNAL NA + SATID 39 SATID 28 VAL1 36 VAL2 073 SIGNAL + 21
UPDATE: I think more test cases are needed.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Preserving "Valid" Data?
by coding1227 (Novice) on Apr 04, 2017 at 05:33 UTC | |
by tybalt89 (Monsignor) on Apr 04, 2017 at 08:30 UTC | |
by coding1227 (Novice) on Apr 05, 2017 at 04:34 UTC |