|< 1 2 >| | 11 Einträge, 2 Seiten |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/bin/sh
#
if (open FIN, "@ARGV[0]")
{
if (open FOUT, ">@ARGV[1]")
{
@a = <FIN>;
$b = 1; $c = @a;
while ($c > 10)
{ $b++; $c/=10; }
for ($i=0; $i<@a; $i++)
{printf FOUT "%0" . $b . "d " . @a[$i], $i;}
close FOUT;
}
close FIN;
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/usr/bin/perl
use strict;
use warnings;
#
# Daten einlesen:
#
open FIN, $ARGV[0] or die $!;
my @lines = <FIN>;
close FIN or warn $!;
#
# Ausgabebreite berechnen:
#
my $stellen = int( 1 + log(scalar @lines) / log(10) );
#
# Daten ausgeben:
#
open FOUT, '>' . $ARGV[1] or die $!;
for my $i (0 .. $#lines) {
printf "%0*d%d", $stellen, $i, $lines[$i];
}
close FOUT or die $!;
1
2
3
open FIN, $ARGV[0] or die $!;
my @lines = grep{$_ !~ /^#/}<FIN>;
close FIN or warn $!;
printf "%0*d%s", $stellen, $i, $lines[$i];
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
#!/usr/bin/perl
#use strict;
#use warnings;
if (open FIN, "@ARGV[0]" )
{
if (open FOUT, ">@ARGV[1]")
{
@a = <FIN>;
$width = 1; $temp = @a;
while ($temp > 10)
{ $width++; $temp/=10; }
for ($i=0, $index=0; $i<@a; $i++)
{
if (substr(@a[$i],0,1) eq "#")
{
printf FOUT @a[$i];
}
else
{
@sp = split("/",@a[$i]);
$temp = @sp[$#sp];
@sp[$#sp] = "";
printf FOUT join("/",@sp) . "%0" . $width . "d_" . $temp, $index++;
}
}
close FOUT;
}
close FIN;
}
|< 1 2 >| | 11 Einträge, 2 Seiten |