Sponsored Content
Top Forums UNIX for Dummies Questions & Answers How to filter out almost dupicate X Y (Easting Northing) coordinates? Post 302455500 by rdcwayx on Tuesday 21st of September 2010 10:05:55 PM
Old 09-21-2010
Jim's code is so perfect.

A little bit of change to easily adjust range value.

Code:
awk -v range=2.75 '{ x=int( ($2/range) + 1.0000001 ) * range
       y=int( ($3/range) + 1.0000001 ) * range
        tmp=sprintf("%.2f|%.2f", x , y)
        print $0, tmp
        if(tmp in arr) {
          print $0 >> "duplicates"
        }
        else {
          print $0 >> "uniques"
          arr[tmp]++
        }
      } ' infile

To kenneth.mcbride,

From the output, the value in last column (separated by |) tell you the secret. It simplifies the whole processes.

Code:
PointNumber_0000001 1000000.123456 1000000.123456 10000.123456 1000001.75|1000001.75
PointNumber_0000010 1000001.234567 1000002.234567 10345.234567 1000001.75|1000004.50
PointNumber_0000100 1000010.345678 1000020.456789 10030.987654 1000012.75|1000021.00
PointNumber_0001000 1000050.345678 1000050.456789 10030.987654 1000051.25|1000051.25
PointNumber_0010000 1000123.123456 1000456.123456 10789.123456 1000125.50|1000458.25
PointNumber_0100000 1000123.123456 1000456.123456 10789.123456 1000125.50|1000458.25
PointNumber_1000000 1000000.123456 1000000.123456 10000.123456 1000001.75|1000001.75
PointNumber_2000000 1000011.345678 1000021.456789 10030.987654 1000012.75|1000023.75
PointNumber_3000000 1000051.000678 1000049.999000 10030.987654 1000051.25|1000051.25

Seesm if two records are "exact duplicate", Jim's code will have wrong output.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Removing dupicate lines in the file ..(they are not continuous)

I have duplicates records in a file, but they are not consecutive. I want to remove the duplicates , using script. Can some one help me in writing a ksh script to implement this task. Ex file is like below. 1234 5689 4556 1234 4444 (7 Replies)
Discussion started by: Srini75
7 Replies

2. Shell Programming and Scripting

Defining X and Y Coordinates Inside A Window

Hello, I am starting up an Xnest window and trying to place a program inside of it. I have the window inside of it now but it always spawns with the top left corner at (0, 0). I need to find a way to set the x and y coordinates to something other than (0, 0). I tried using the -geometry option... (1 Reply)
Discussion started by: lesnaubr
1 Replies

3. Shell Programming and Scripting

Calculating distance between two LAT long coordinates

hi, i have a pair of latitude and longitude and i want to calculate the distance between these two points. In vbscript i achieved in the following way...Now i want to implement this in unix shell scripting.... <% Dim lat1, lon1, lat2, lon2 const pi = 3.14159265358979323846 ... (8 Replies)
Discussion started by: aemunathan
8 Replies

4. Shell Programming and Scripting

Search for particular tag and arrange as coordinates

Hi I have a file whose sample contents are shown here, 1.2.3.4->2.4.2.4 a(10) b(20) c(30) 1.2.3.4->2.9.2.4 a(10) c(20) 2.3.4.3->3.6.3.2 b(40) d(50) c(20) 2.3.4.3->3.9.0.2 a(40) e(50) c(20) 1.2.3.4->3.4.2.4 a(10) c(30) 6.2.3.4->2.4.2.5 c(10) . . . . Here I need to search... (5 Replies)
Discussion started by: AKD
5 Replies

5. Shell Programming and Scripting

place cursor in specific coordinates

Hi, I have this problem on how to place the cursor in a text editor (for example: pico). I made this script that would attach comments to a script file then open the script file, I would like to know how to place the cursor in a specific place, for example at the end of the comments, ... (1 Reply)
Discussion started by: lechelle
1 Replies

6. Shell Programming and Scripting

Determination n points between two coordinates

Hi guys. Can anyone tell me how to determine points between two coardinates. For example: Which type of command line gives me 50 points between (8, -5, 7) and (2, 6, 9) points Thanks (5 Replies)
Discussion started by: rpf
5 Replies

7. Shell Programming and Scripting

Differential substring removal using coordinates

Hello all, this might be better suited for a bioinformatics forum, but I thought I'd try my luck here as well. I have several tabular text files of DNA sequence reads that appear as such: File_1.txt >H01BA45XW GATTACAGATTCGACATCCAACTGAGGCATT >H02BG78WR CCTTACAGACTGGGCATGAATATTGCATACC... (3 Replies)
Discussion started by: vectorborne5
3 Replies

8. UNIX for Dummies Questions & Answers

Length of a segment based on coordinates

Hi, I would like to have the length of a segment based on coordinates of its parts. Example input file: chr11 genes_good3.gtf aggregate_gene 1 100 gene1 chr11 genes_good3.gtf exonic_part 1 60 chr11 genes_good3.gtf exonic_part 70 100 chr11 genes_good3.gtf aggregate_gene 200 1000 gene2... (2 Replies)
Discussion started by: fadista
2 Replies

9. UNIX for Dummies Questions & Answers

overlapped genomic coordinates

Hi, I would like to know how can I get the ID of a feature if its genomic coordinates overlap the coordinates of another file. Example: Get the 4th column (ID) of this file1: chr1 10 100 gene1 chr2 3000 5000 gene2 chr3 200 1500 gene3 if it overlaps with a feature in this file2: chr2... (1 Reply)
Discussion started by: fadista
1 Replies

10. UNIX for Beginners Questions & Answers

Help with processing coordinates in a file.

I have a variation table (variation.txt) which is a very big file. The first column in the chromosome number and the second column is the position of the variation. I have a second file annotation.txt which has a list of 37,000 genes (1st column), their chromosome number(2nd column), their start... (1 Reply)
Discussion started by: Sanchari
1 Replies
sms_client(1)							   User Manuals 						     sms_client(1)

NAME
sms_client - send messages to mobiles and pagers. SYNOPSIS
sms_client [-v] sms_client [-d] sms_client [-q] [-l loglevel] [service:]number|name[,[service:]number|name] [message] ... DESCRIPTION
A simple client implementation for the GSM Short Message Service (SMS) using TAP. Allowing you to send messages to mobile phones and pagers. Several drivers have also been written for providers who use protocols other than TAP. This client dials the Short Message Service centre and passes on your message addressed to the number or name you specified. Any name you use is expanded to the number from either the Local or Global resource files. The Local file is searched first then the Global file. A user can set up his own preferences to overide those set in the Global file. Information regarding the status of the call is displayed, along with the response given by the SMS centre as the message is transmitted. If no message is present, sms_client takes the message from standard input. OPTIONS
-q Quiet mode, no output. -l All messages output are appended to /var/log/smsclient.log, there are several level of loggin. The default loglevel is STANDARD other loggin levels provided include. 1 - ERROR 2 - WARNING 3 - STANDARD 4 - VERBOSE 5 - EXTREMELY VERBOSE -v Print version information. -d Print all driver/protocols currently built into sms_client. [service:]number|name[,[service:]number|name] A name can be used instead of a number, if a name is used it is searched for in the Global and Local resource files and replaced by the number. You can group names and numbers but they must be seperated by a comma and must contain no whitespace. Numbers must be in International format. For UK Numbers remove leading 0 and add 44 prefix. If a number is prefixed with service: then that service is used in preference to the default service. [message]... A Quoted message that you want to send. If this is absent the message is read from stdin. The maximum length of the message is cur- rently set to a limit of 150 characters, if your message exceeds this length you will be notified with an error message. RETURN VALUES
On Success the return value is set to zero. Any other value indicates an error occurred. Each number dialed will have a corresponding output of the form: [###]SERVICE:NUMBER Where ### is the delivery code, 000 indicates successful delivery other values can be found in sms_error.h EXAMPLES
sms_client 123456 'Hello 123456' Use default service and send message to 123456 sms_client mike 'Hello mike' Use default service and send message to number associated with name mike found in one of the resource files. sms_client mike,angelo 'Hello mike and angelo' Use default service and send message to number associated with names mike and angelo found in one of the resource files. FILES
/etc/smsclient/sms_addressbook The Global addressbook file. Containing names and numbers. ~/.sms_addressbook The Local addressbook file. Contains names and numbers which can override those in the Global resource file. /etc/smsclient/sms_config Containing default service and other sms_client defaults. /etc/smsclient/sms_services Containing service to protocol mappings. /etc/smsclient/sms_modem Containing default modem settings. /etc/smsclient/services Directory containing all services - Each service is denoted by filename (in UPPERCASE) and contains defaults for that service, such as telephone number of service centre, comms params etc. /var/lock/smslock Lockfile generated when smsclient is running. /var/log/smslog Log file where all messages that are produced are copied. AUTHOR
Angelo Masci <angelo@styx.demon.co.uk> changed by Michael Holzt <kju@debian.org> for the Debian/GNU Linux Package VERSION
2.0.7 Linux 19 Oct 1998 sms_client(1)
All times are GMT -4. The time now is 04:44 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy