Search Results

Search: Posts Made By: getmmg
2,160
Posted By getmmg
perl -lane '$a{$F[0]}++}{foreach (keys %a){print...
perl -lane '$a{$F[0]}++}{foreach (keys %a){print "$_ $a{$_}"}' input
16,579
Posted By getmmg
perl -pe 's/\"//g;s/,/\n/g' input.
perl -pe 's/\"//g;s/,/\n/g' input.
1,319
Posted By getmmg
perl -lne 'if (/Record/){$_= <> ;print}'...
perl -lne 'if (/Record/){$_= <> ;print}' Input
9,344
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
9,344
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,424
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
3,988
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,204
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,275
Posted By getmmg
perl -0pe 's/\n;/;/g' input
perl -0pe 's/\n;/;/g' input
3,426
Posted By getmmg
perl -lne 's/\s+/\t/;print' inp
perl -lne 's/\s+/\t/;print' inp
12,139
Posted By getmmg
perl -pe 's/\bDS\b/blah/' input DS1 DDS blah
perl -pe 's/\bDS\b/blah/' input
DS1
DDS
blah
1,766
Posted By getmmg
perl -0lne 'print "$1\n" while /Log...
perl -0lne 'print "$1\n" while /Log viewer\/(\w+)/g' input
2,165
Posted By getmmg
perl -0ne 'print $1 if /Start(.*)END/sg' input
perl -0ne 'print $1 if /Start(.*)END/sg' input
2,412
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,804
Posted By getmmg
How about this perl -0pe...
How about this

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

perl -0pe '/pattern((.*\n){4})/;$_=$1' input.
904
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)
{
...
4,482
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,886
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
4,482
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...
904
Posted By getmmg
What have you tried so far?
What have you tried so far?
1,886
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 )
4,482
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 05:10 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy