Search Results

Search: Posts Made By: getmmg
1,814
Posted By getmmg
perl -lane '$a{$F[0]}++}{foreach (keys %a){print...
perl -lane '$a{$F[0]}++}{foreach (keys %a){print "$_ $a{$_}"}' input
14,818
Posted By getmmg
perl -pe 's/\"//g;s/,/\n/g' input.
perl -pe 's/\"//g;s/,/\n/g' input.
1,021
Posted By getmmg
perl -lne 'if (/Record/){$_= <> ;print}'...
perl -lne 'if (/Record/){$_= <> ;print}' Input
8,036
Posted By getmmg
Didn't know that. Try this, Never done one liners...
Didn't know that. Try this, Never done one liners in windows though.
This might work.


perl -F':|,' -lane "'$sum+=$F[1];}{print $sum/$.'" temp1
8,036
Posted By getmmg
Can you try this perl -F':|,' -lane...
Can you try this

perl -F':|,' -lane '$sum+=$F[1];}{print $sum/$.' fps.csv
30.1827114285714
1,127
Posted By getmmg
If you want a perl solution :) perl -0ane...
If you want a perl solution :)

perl -0ane 'print "$1 $2\n" while /(.*)\n(.*)\n/g' input
2,916
Posted By getmmg
$ perl -lane '$k1="$F[0] $F[1] $F[2]";$k2="$F[0]...
$ perl -lane '$k1="$F[0] $F[1] $F[2]";$k2="$F[0] $F[2] $F[1]";$h{$k1}+=0 if !(exists $h{$k1} || exists $h{$k2}) }{print foreach keys %h' inputfile
1,073
Posted By getmmg
FILE is the name of the file handle, in_file is...
FILE is the name of the file handle,
in_file is the name of the file you are trying to read.
3,026
Posted By getmmg
perl -0pe 's/\n;/;/g' input
perl -0pe 's/\n;/;/g' input
3,238
Posted By getmmg
perl -lne 's/\s+/\t/;print' inp
perl -lne 's/\s+/\t/;print' inp
10,717
Posted By getmmg
perl -pe 's/\bDS\b/blah/' input DS1 DDS blah
perl -pe 's/\bDS\b/blah/' input
DS1
DDS
blah
1,492
Posted By getmmg
perl -0lne 'print "$1\n" while /Log...
perl -0lne 'print "$1\n" while /Log viewer\/(\w+)/g' input
1,847
Posted By getmmg
perl -0ne 'print $1 if /Start(.*)END/sg' input
perl -0ne 'print $1 if /Start(.*)END/sg' input
2,211
Posted By getmmg
Try this perl -lne '$a=substr...
Try this


perl -lne '$a=substr $_,10,9;$b=substr $_,31,9; s/$a/---------/g if($a!~/\d{9}/);s/$b/---------/g if($b!~/\d{9}/);print' input
5,372
Posted By getmmg
How about this perl -0pe...
How about this

perl -0pe 's/.*(real.*not\n).*/\1/sg' input
12,732
Posted By getmmg
perl -0pe 's/\n/,/g' input
perl -0pe 's/\n/,/g' input
1,429
Posted By getmmg
perl -ane 'if(/table/){$_=<>;@a=split;print...
perl -ane 'if(/table/){$_=<>;@a=split;print "$F[7] - $a[1]\n"}' input
1,143
Posted By getmmg
One more way, perl -0pe...
One more way,

perl -0pe '/pattern((.*\n){4})/;$_=$1' input.
770
Posted By getmmg
How about this use strict; print...
How about this


use strict;
print "Enter File Name: ";
my $fileName = <STDIN>;
chomp($fileName);
print "Enter Number: ";
my $no = <STDIN>;
chomp($no);
if(-e $fileName)
{
...
3,957
Posted By getmmg
Not sure why. For me its looks fine. Ouput...
Not sure why. For me its looks fine.
Ouput file is also Ascii text not a binary.

Whats your OS btw?
1,595
Posted By getmmg
Remove the double quotes in the script. ...
Remove the double quotes in the script.


perl -pe '$j=sprintf "%05d",++$i;s/\d+ /$j /' q6.txt
3,957
Posted By getmmg
-0lne reads the whole file. s/\n//g replaces...
-0lne reads the whole file.
s/\n//g replaces all new line charecters and makes it into a single line.

print "$1\n" while /(.*?{})/g' this will try to do a minimalistic pattern match for any...
770
Posted By getmmg
What have you tried so far?
What have you tried so far?
1,595
Posted By getmmg
Works here. See the output perl -pe...
Works here. See the output


perl -pe '$j=sprintf "%05d",++$i;s/\d+ /$j /' te1
( chp_testfile_00001 Blablabla. )
( chp_testfile_00002 Blablabla )
( chp_testfile_00003 Blablabla )
3,957
Posted By getmmg
If {} marks the end of line, try this ...
If {} marks the end of line, try this


perl -0lne 's/\n//g;print "$1\n" while /(.*?{})/g' input file.
Showing results 1 to 25 of 124

 

Featured Tech Videos

All times are GMT -4. The time now is 12:13 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy