05-21-2010
///Quick question for the OP...are the files sorted and the records are guaranteed in the same order? Otherwise, what's the key to tie the records? I ask since your initial evaluation seems to focus on flags like chr1...///
Thank you very much guys. I did not expect such quick responses. Somehow I did not get email alerts too.
To answer your question, file 2 is sorted by 'chr' (ascending) and file 1 is sorted by field 1 (ascending). I have not tried the code given here yet. I will check it out.
Thanks a ton you guys - you rock.
---------- Post updated at 09:12 PM ---------- Previous update was at 09:08 PM ----------
Quote:
Originally Posted by
polsum
To answer your question, file 2 is sorted by 'chr' (ascending) and file 1 is sorted by field 1 (ascending).
oopsy - file 2 is sorted by field 1 and file 1 is sorted by chr (chr1 to chr19).
---------- Post updated at 09:47 PM ---------- Previous update was at 09:12 PM ----------
Quote:
Originally Posted by
curleb
$ paste -d\\n Edit1 Edit2 |awk '{chr=$6; min=$7; max=$8; s=$11" "$12" "$13; getline; if (chr==$4 && $5>=min && $5<=max) print $0;}'
Sorry being so dumb but when i execute this code in my xp computer, i am getting all kinds of errors like " the system cant find the path specified", and at s=$11^ unexpected newline or end of a string found" . Can you please tell me where am I doing wrong? thanks.
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
I have the following situation :
i have 4 Unix Sco servers, one Windows 2000 server, and an ADSL internet connection. All the servers, that is the 4 unix and the windows server have real static IPs supplied by my ISP.
the servers are connected to a Switch , the switch is connected to an... (2 Replies)
Discussion started by: BAM
2 Replies
2. Programming
Hello,
I'm working on an application that bridges together several applications involved in creating a video workflow for editing with digital cinema cameras. The main platform is MacOSX.
Because of the nature of some of the utilities for working with this video footage I must spoof filenames... (2 Replies)
Discussion started by: ibloom
2 Replies
3. Shell Programming and Scripting
Hi,
This is the Third thread i'm putting here for the same problem. :(
Actually, i'm trying a script like this.. but its taking a long time.. about 3 days to complete fully..
#!/bin/ksh
if
then
exit 1
fi
while read i
do
while read j
do
field7=`echo $j|cut -d "|"... (12 Replies)
Discussion started by: RRVARMA
12 Replies
4. Shell Programming and Scripting
hi i am trying to perform some calculations with awk and arrays. i have this so far:
awk 'NR==FNR{ for(i=1; i<=NF; i++) {array+=$i} tot++;next}
{for(i=1; i<=NF; i++) {avg=array/tot} {diff=(array - avg)}} {for(i=1; i<=NF; i++) {printf("%5.8f\n",diff)}}' "$count".txt "$count".ttt >... (4 Replies)
Discussion started by: npatwardhan
4 Replies
5. Shell Programming and Scripting
I'm at wits end with this issue and my troubleshooting leads me to believe it is a problem with the file formatting of the array referenced by my script:
awk -F, '{if (NR==FNR) {a=$4","$3","$2}\
else {print a "," $0}}' WBTSassignments1.txt RNCalarms.tmp
On the WBTSassignments1.txt file... (2 Replies)
Discussion started by: JasonHamm
2 Replies
6. Shell Programming and Scripting
Dear All,
I am facing problem to get right output through awk program
I have file in which “B” value is appearing multiple time and I need to capture all these values.
My script is
BEGIN { FS=" " }
{
if ( substr($1,1,5) == "START" )
{
i =... (2 Replies)
Discussion started by: arvindng
2 Replies
7. Shell Programming and Scripting
Hi,
Im trying to count bats flying through an infrared beam array. One of the experts here helped me a few months ago but now I am having a problem that is stumping me.
here is the original code that works (with two differnt patterns in array):
# this has been changed to operate under the... (15 Replies)
Discussion started by: cmp260
15 Replies
8. Shell Programming and Scripting
I am trying to map values in the input file, where 2nd column depends on the specific value in the 1st column. When 1st column is A place 1 into 2nd column, when it is B, place 2, when C place 3, otherwise no change.
My input:
U |100|MAIN ST |CLMN1|1
A |200|GREEN LN |CLMN2|2
1 |12... (4 Replies)
Discussion started by: migurus
4 Replies
9. Shell Programming and Scripting
Hi, I have a problem with awk array when iam trying to use awk in solaris box as below..Iam unable to figure out the problem..
Need your help. is there any alternative to make it in arrays from variable values
nawk 'BEGIN {SUBSEP=" ";
split("101880|110045 101887|110045 101896|110045... (9 Replies)
Discussion started by: cskumar
9 Replies
10. Shell Programming and Scripting
I am trying to reformat the table by filling any missing rows. The final table will have consecutive IDs in the first column. My problem is the index of the associate array in the awk script.
infile:
S01 36407 53706 88540
S02 69343 87098 87316
S03 50133 59721 107923... (4 Replies)
Discussion started by: yifangt
4 Replies
LEARN ABOUT CENTOS
slamrg
slamrg.f(3) LAPACK slamrg.f(3)
NAME
slamrg.f -
SYNOPSIS
Functions/Subroutines
subroutine slamrg (N1, N2, A, STRD1, STRD2, INDEX)
SLAMRG creates a permutation list to merge the entries of two independently sorted sets into a single set sorted in ascending order.
Function/Subroutine Documentation
subroutine slamrg (integerN1, integerN2, real, dimension( * )A, integerSTRD1, integerSTRD2, integer, dimension( * )INDEX)
SLAMRG creates a permutation list to merge the entries of two independently sorted sets into a single set sorted in ascending order.
Purpose:
SLAMRG will create a permutation list which will merge the elements
of A (which is composed of two independently sorted sets) into a
single set which is sorted in ascending order.
Parameters:
N1
N1 is INTEGER
N2
N2 is INTEGER
These arguements contain the respective lengths of the two
sorted lists to be merged.
A
A is REAL array, dimension (N1+N2)
The first N1 elements of A contain a list of numbers which
are sorted in either ascending or descending order. Likewise
for the final N2 elements.
STRD1
STRD1 is INTEGER
STRD2
STRD2 is INTEGER
These are the strides to be taken through the array A.
Allowable strides are 1 and -1. They indicate whether a
subset of A is sorted in ascending (STRDx = 1) or descending
(STRDx = -1) order.
INDEX
INDEX is INTEGER array, dimension (N1+N2)
On exit this array will contain a permutation such that
if B( I ) = A( INDEX( I ) ) for I=1,N1+N2, then B will be
sorted in ascending order.
Author:
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Date:
September 2012
Definition at line 100 of file slamrg.f.
Author
Generated automatically by Doxygen for LAPACK from the source code.
Version 3.4.2 Tue Sep 25 2012 slamrg.f(3)