white space [1]
3 отговора
254 прегледа
white space [1]
zdr
imam file koito izglejda taka:
1
2
3
4
...
kak moga da go napravia da izglejda taka
1
2
3
4
t.e. da mahna white space-ovete?
imam file koito izglejda taka:
1
2
3
4
...
kak moga da go napravia da izglejda taka
1
2
3
4
t.e. da mahna white space-ovete?
Re: white space [1]
awk 'NF > 0' myfile
awk '/./' myfile
sed -e '/^$/d' myfile
perl -ne 'print unless /^ *$/' myfile
awk '/./' myfile
sed -e '/^$/d' myfile
perl -ne 'print unless /^ *$/' myfile
Re: white space [1]
imash 2 varianta:
# 1: one-liner:
>perl -i -pe 's/^\s*$//' some_filename
# 2: programa:
#!/usr/bin/perl
my $file = shift;
-f $file or die "no file given\n";
{
open my $rh, $file or die $!;
open my $wh, "> $file.tmp" or die $!;
while( <$rh> ){
s/^\s*$//;
print $wh $_;
}
close $rh;
close $wh;
rename "$file.tmp", $file;
}
__END__
#~
$_->[/^(?>(.)?(.)+.*)(?!\1)(??{print(($1..$2)[9,0,15,7])})/]
#~
# 1: one-liner:
>perl -i -pe 's/^\s*$//' some_filename
# 2: programa:
#!/usr/bin/perl
my $file = shift;
-f $file or die "no file given\n";
{
open my $rh, $file or die $!;
open my $wh, "> $file.tmp" or die $!;
while( <$rh> ){
s/^\s*$//;
print $wh $_;
}
close $rh;
close $wh;
rename "$file.tmp", $file;
}
__END__
#~
$_->[/^(?>(.)?(.)+.*)(?!\1)(??{print(($1..$2)[9,0,15,7])})/]
#~
Re: white space [1]
тоя пич с пърл-ва вече се прави на интересен
the lord of destruction
the lord of destruction