Search Results

Search: Posts Made By: getmmg
2,197
Posted By getmmg
perl -lane '$a{$F[0]}++}{foreach (keys %a){print...
perl -lane '$a{$F[0]}++}{foreach (keys %a){print "$_ $a{$_}"}' input
16,852
Posted By getmmg
perl -pe 's/\"//g;s/,/\n/g' input.
perl -pe 's/\"//g;s/,/\n/g' input.
1,374
Posted By getmmg
perl -lne 'if (/Record/){$_= <> ;print}'...
perl -lne 'if (/Record/){$_= <> ;print}' Input
9,606
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,606
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,493
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,111
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,254
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,422
Posted By getmmg
perl -0pe 's/\n;/;/g' input
perl -0pe 's/\n;/;/g' input
3,473
Posted By getmmg
perl -lne 's/\s+/\t/;print' inp
perl -lne 's/\s+/\t/;print' inp
12,576
Posted By getmmg
perl -pe 's/\bDS\b/blah/' input DS1 DDS blah
perl -pe 's/\bDS\b/blah/' input
DS1
DDS
blah
1,839
Posted By getmmg
perl -0lne 'print "$1\n" while /Log...
perl -0lne 'print "$1\n" while /Log viewer\/(\w+)/g' input
2,222
Posted By getmmg
perl -0ne 'print $1 if /Start(.*)END/sg' input
perl -0ne 'print $1 if /Start(.*)END/sg' input
2,453
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,875
Posted By getmmg
How about this perl -0pe...
How about this

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

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