Search Results

Search: Posts Made By: empyrean
2,281
Posted By Chubler_XL
@pamu your solution requires that input file is...
@pamu your solution requires that input file is sorted, the solution I posted didn't assume this, mostly because empyrean's posted code required sort:

cat file | awk '$3 ~/A|T|G|C/{print $0}'|...
2,281
Posted By pamu
I assume if second column is count of...
I assume if second column is count of occurrences. then third row should contain 2 in second column.

This is lit bit nasty code..:D

awk 'function prnt() {
split(A[S],ARR);
...
2,281
Posted By Chubler_XL
Think this does what you want awk ' ...
Think this does what you want

awk '
$3!="." {
key=$1"\t"$2
if(!(key in I)) D[++keys]=key
if(!((key SUBSEP $3) in M)) {
I[key]++
K[key,I[key]]=$3
...
1,859
Posted By Don Cragun
Hi pamu, To answer your question about changing...
Hi pamu,
To answer your question about changing FS for different files: If you want to use the default setting for FS for the 1st input file and use another setting for FS for subsequent files, all...
1,192
Posted By msabhi
perl -alne '{$h{"$F[1]...
perl -alne '{$h{"$F[1] $F[2]"}[0].=",$F[0]";$h{"$F[1] $F[2]"}[1].="$F[3];";}
END { foreach $item (sort keys %h ) {
$Tget="$h{$item}[0] $item $h{$item}[1]";$Tget=~s/(^,|;$)//g;print "$Tget"; }}'...
1,192
Posted By vgersh99
awk -f em.awk myFile em.awk: BEGIN { ...
awk -f em.awk myFile
em.awk:

BEGIN {
c=","
sc=";"
}
{
idx=($2 OFS $3)
o[idx]=(idx in o)?o[idx] c $1:$1
f[idx]=(idx in f)?f[idx] sc $4:$4
}
END {
for (i in o)
print...
1,192
Posted By pamu
awk...
awk '{a[$2,$3]=a[$2,$3]?$1","a[$2,$3]";"$4:$0}END{for(i in a){print a[i]}}' file
5,472
Posted By Don Cragun
Here is a way to do what I think you're trying to...
Here is a way to do what I think you're trying to do using awk:
#!/bin/ksh
awk '
BEGIN { hdr2 = "Index" }
NF==1 { # WIth only one field, we have to be processing the index file.
if(FNR...
5,472
Posted By msabhi
#! /bin/perl open(IDX,"<Index") || die...
#! /bin/perl
open(IDX,"<Index") || die "Couldn't open index file";
@index=<IDX>;
close IDX;
$header{POSITION}="Position";
for($i=0;$i<$#ARGV+1;$i++)
{
$FH="F${i}";
open($FH,"< $ARGV[${i}]")...
2,721
Posted By radoulov
Could you post the output of the following...
Could you post the output of the following command:

od -bc file2 | head
2,721
Posted By pravin27
How about this, awk...
How about this,
awk 'NR==FNR{a[$1]=a[$1]","$2;b[$1]=$3;next} b[$1] {print $0,a[$1],b[$1]}' file1 file2
2,721
Posted By radoulov
I get this output: zsh-4.3.11[t]% head...
I get this output:

zsh-4.3.11[t]% head file[12]
==> file1 <==
1 aa rep
1 dd rep
1 kk rep
2 bb sad
2 ss sad
3 ee dam

==> file2 <==
1 apple fruit
2 mango tree
3 lilly flower...
Showing results 1 to 12 of 12

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