Search Results

Search: Posts Made By: Tzeronone
2,369
Posted By RudiC
For your first request, which included only the...
For your first request, which included only the first four lines of your output equivalent to formation's content, this might work:awk 'FILENAME != "formation" ...
2,170
Posted By summer_cherry
perl code
my $pre;
while(<DATA>){
chomp;
if($.==1){
$pre = $_;
next;
}
else{
my @arr = split(" ",$_);
if($arr[1]%4==0){
print $pre,"\n";
print $_,"\n";
}
$pre = $_;
}
}...
2,693
Posted By itkamaraj
#! /usr/bin/perl -w use strict; open...
#! /usr/bin/perl -w
use strict;
open FP1,"A.txt";
open FP2,"B.txt";
open FP3, ">A_B.txt" or die $!;
my ($l1,$l2);
while(1)
{
$l1=<FP1>; chomp $l1;
$l2=<FP2>; chomp $l2;
last...
2,693
Posted By Grant Pryor
Well that would be the general way to do it. ...
Well that would be the general way to do it.

you can always add it into your perl script.

just add `./paste > A_B.txt`; to your code at the end.
4,666
Posted By Chubler_XL
OK now I see how is should work, try this: ...
OK now I see how is should work, try this:

awk '
{ P[$1]=$2 ; m=m?m:$1; n=$1>n?$1:n; x[NR]=$1 ; y[NR]=$2 }
END {
x[0]=y[0]=0
p=-2
for(i=m;i<=n;i++) {
if (i in P) { p++;...
4,666
Posted By Chubler_XL
Damn, Here is a debug version that show the...
Damn,

Here is a debug version that show the formula with expanded values, it might help us find the issue.

Note data file should not contain the heading (#X Y) line:

awk '
{ P[$1]=$2 ;...
4,666
Posted By Chubler_XL
How about this: awk ' { P[$1]=$2 ;...
How about this:

awk '
{ P[$1]=$2 ; m=$1>m?$1:m; x[NR]=$1 ; y[NR]=$2 }
END {
for(i=1;i<=m;i++) {
if (i in P) printf "%0.4f %0.4f\n", i, P[i];
else printf "%0.4f %0.4f\n", i,...
Showing results 1 to 7 of 7

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