File: hd5ToTime.pl

package info (click to toggle)
dmrgpp 6.06-2
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 113,900 kB
  • sloc: cpp: 80,986; perl: 14,772; ansic: 2,923; makefile: 83; sh: 17
file content (36 lines) | stat: -rwxr-xr-x 519 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/usr/bin/perl

use strict;
use warnings;
use utf8;

my $cmd = "h5dump -d /Def/FinalPsi/TimeSerializer/Time ";

my @files = (@ARGV);

foreach my $file (@files) {
	my $cmd2 = "$cmd \"$file\"";
	my $ret = open(PIPE, "$cmd2 |");
	if (!$ret) {
		print STDERR "$0: Could not open pipe $cmd2\n";
		next;
	}

	my $time;
	while (<PIPE>) {
		chomp;
		if (/\(0\)\: (.*$)/) {
			$time = $1;
			last;
		}
	}

	if (!$time) {
		print STDERR "$0: Could not find Time in $file\n";
		next;
	}

	print "$file $time\n";
	close(PIPE);
}