Search Results

Search: Posts Made By: getmmg
2,306
Posted By getmmg
perl -lane '$a{$F[0]}++}{foreach (keys %a){print...
perl -lane '$a{$F[0]}++}{foreach (keys %a){print "$_ $a{$_}"}' input
17,428
Posted By getmmg
perl -pe 's/\"//g;s/,/\n/g' input.
perl -pe 's/\"//g;s/,/\n/g' input.
1,522
Posted By getmmg
perl -lne 'if (/Record/){$_= <> ;print}'...
perl -lne 'if (/Record/){$_= <> ;print}' Input
10,127
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
10,127
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,629
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
4,268
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,393
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,702
Posted By getmmg
perl -0pe 's/\n;/;/g' input
perl -0pe 's/\n;/;/g' input
3,674
Posted By getmmg
perl -lne 's/\s+/\t/;print' inp
perl -lne 's/\s+/\t/;print' inp
13,232
Posted By getmmg
perl -pe 's/\bDS\b/blah/' input DS1 DDS blah
perl -pe 's/\bDS\b/blah/' input
DS1
DDS
blah
2,001
Posted By getmmg
perl -0lne 'print "$1\n" while /Log...
perl -0lne 'print "$1\n" while /Log viewer\/(\w+)/g' input
2,354
Posted By getmmg
perl -0ne 'print $1 if /Start(.*)END/sg' input
perl -0ne 'print $1 if /Start(.*)END/sg' input
2,579
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
6,082
Posted By getmmg
How about this perl -0pe...
How about this

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

perl -0pe '/pattern((.*\n){4})/;$_=$1' input.
1,003
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)
{
...
5,094
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?
2,041
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
5,094
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...
1,003
Posted By getmmg
What have you tried so far?
What have you tried so far?
2,041
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 )
5,094
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

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