source: projects/perl-tools/strip-null-bytes @ 1

Last change on this file since 1 was 1, checked in by sven, 16 years ago

Erstimport

File size: 446 bytes
Line 
1#!/usr/bin/perl
2#
3# Strippt Nullbytes vorne und hinten von STDIN-Daten
4# oder Parameter (Datei) weg.
5#
6
7my @data = split/\s+/, join ' ', <>;
8
9# strip at beginning
10$x=0;
11for(@data) {
12$x++;
13    print STDERR "$x: $_\n";
14    unless( /^00?$/ ) {
15        print STDERR "$x: $_ No more nullbytes.\n";
16    }
17
18    last unless /^00?$/;
19    shift(@data);
20}
21
22#@data = reverse(@data);
23#do STRIP;
24#@data = reverse(@data);
25
26map { print pack("C", hex $_) } @data;
Note: See TracBrowser for help on using the repository browser.
© 2008 - 2013 technikum29 • Sven Köppel • Some rights reserved
Powered by Trac
Expect where otherwise noted, content on this site is licensed under a Creative Commons 3.0 License