Search Results

Search: Posts Made By: R3353
4,659
Posted By shamrock
I am not sure why you are getting incorrect...
I am not sure why you are getting incorrect results as the output on my system is exactly what you want...i changed the awk script slightly so it uses if else statements instead of the conditional...
4,659
Posted By bakunin
Let us first have some rough estimations about...
Let us first have some rough estimations about sizes:

How many rows/columns will this matrix have? Will there be empty matrix elements? The background is: there are some limitations which may or...
4,659
Posted By shamrock
Try this awk script... awk -F, 'BEGIN {OFS =...
Try this awk script...

awk -F, 'BEGIN {OFS = ","}
{
t = t ? (l != $1 ? t OFS $1 : t) : OFS $1
x[$1] = x[$1] ? x[$1] OFS $NF : $NF
l = $1
} END {
print t
for (i in x) print i,...
1,194
Posted By birei
Hi R3353, One way using perl: $ cat...
Hi R3353,

One way using perl:

$ cat script.pl
use warnings;
use strict;

my (%hash);

while ( <> ) {

chomp;

my @f = split /,/;

if ( $f[0] eq $f[1] ) {
...
1,194
Posted By shamrock
Yes awk has an existence operator... awk -F,...
Yes awk has an existence operator...
awk -F, '{if (!($1$2 in x || $2$1 in x)) x[$1$2] = $0} END {for (i in x) print x[i]}' file
52,056
Posted By bartus11
perl -ne 'print unless $a{$_}++' file
perl -ne 'print unless $a{$_}++' file
Showing results 1 to 6 of 6

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