Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Matching position and output neighbors within 500 distant Post 302883589 by fat on Wednesday 15th of January 2014 10:29:32 AM
Old 01-15-2014
Matching position and output neighbors within 500 distant

Hi,
I have been struggling to match positions output its neigbors. Can you please help ?

I have 2 files.They both have the same format (same number of columns) but first file is a kind of subset of second file

The first file looks like this (tab delimited):

Code:
1 11567687 snpid20
1 153881 snpid1
2 56768799 snpid7
3 3156760 snpid4
3 1567687 snpid7

I want to search every line of first file from the second file.
I want to output every line (from second file) within plus or minus 500 the value of the second column of first file

Thanks
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

View file on distant machine

Hello everybody, I have a program that connects to a distant machine using a specific port. Then inetd executes a command on that distant machine (M2). What I'd like to do is write a scipt that, given the port, it gives me the command executed. (The script should be launched on the local... (5 Replies)
Discussion started by: Majid
5 Replies

2. Shell Programming and Scripting

Cut output to same byte position

Hi folks I have a file with thousands of lines with fixed length fields: sample (assume x is a blank space) 111333xx444TTTLKOPxxxxxxxxx I need to make a copy of this file but with only some of the field positions, for example I'd like to copy the sample to the follwing: so I'd like to... (13 Replies)
Discussion started by: HealthyGuy
13 Replies

3. Shell Programming and Scripting

Fill the values between -500 to 500 -awk

input -200 2.4 0 2.6 30 2.8 output -500 0 -499 0 -488 0 .......... .......... .... -200 2.4 .... ... 0 2.6 (6 Replies)
Discussion started by: quincyjones
6 Replies

4. Shell Programming and Scripting

loop with OK or NOK output at the same position

Hi This is my script $ cat ./openldap_test.sh #!/bin/bash for ldap_srv in 'testserver1' 'server2' 'server3' 'server4' 'testserver5' 'server6' 'server7' 'server8' 'server9' 'testserver10'; do ldapsearch -LLL -x -H ldap://$ldap_srv '(cn=examplebox)' memberNisNetgroup > /dev/null if ; then... (1 Reply)
Discussion started by: slashdotweenie
1 Replies

5. Shell Programming and Scripting

Find the position of lines matching string

I have a file with the below format, GS*8***** ST*1******** A* B* E* RMR*123455(This is the unique number to locate this row) F* SE*1*** GE** GS*9***** ST*2 H* J* RMR*567889(This is the unique number to locate this row) L* SE* GE***** (16 Replies)
Discussion started by: Muthuraj K
16 Replies

6. UNIX for Dummies Questions & Answers

Help with finding matching position on strings

I have a DNA file like below and I am able to write a short program which finds/not an input motif, but I dont understand how I can include in the code to report which position the motif was found. Example I want to find the first or all "GAT" motifs and want the program to report which position... (12 Replies)
Discussion started by: pawannoel
12 Replies

7. UNIX for Dummies Questions & Answers

Process on distant server

Hello, I have a question regarding how to manage a process on a distant unix server. I perform calculations on a dedicated Unix server (RedHat ELS5.5) using Matlab (installed on the server). The commands are written in a terminal session (via ssh) on my laptop (MacBook Pro6,2 - MacOS X 10.6.7).... (1 Reply)
Discussion started by: antonino_ch
1 Replies

8. Shell Programming and Scripting

Shell script to retrieve first degree neighbors

I have a file with two columns and each pair in the rows denote 2 connected nodes in the network file, edge_list.txt. Given a query file, input.txt, I want to retrieve the nodes that are directly connected (first degree neighbors) to the nodes present in the input.txt. Kindly help. ... (3 Replies)
Discussion started by: Sanchari
3 Replies

9. Shell Programming and Scripting

awk usage for position matching

i have a requirement like this if the line contains from position 294 to 299 is equal to "prabhu" ,then print entire line . i want to use awk awk '{if(substr(294-299) == 'prabhu') print "line" }' filename (1 Reply)
Discussion started by: ptappeta
1 Replies

10. UNIX for Dummies Questions & Answers

String pattern matching and position

I am not an expert with linux, but following various posts on this forum, I have been trying to write a script to match pattern of charters occurring together in a file. My file has approximately 200 million characters (upper and lower case), with about 50 characters per line. I have merged all... (5 Replies)
Discussion started by: biowizz
5 Replies
pr(1)							      General Commands Manual							     pr(1)

NAME
pr - print files SYNOPSIS
[options] [files] DESCRIPTION
The command prints the named files on the standard output. If file is or if no files are specified, the standard input is assumed. By default, the listing is separated into pages, each headed by the page number, a date and time, and the name of the file. By default, columns are of equal width, separated by at least one space; lines that do not fit are truncated. If the option is used, lines are not truncated and columns are separated by the separation character. If the standard output is associated with a terminal, error messages are withheld until has completed printing. Options The following options can be used singly or combined in any order: Begin printing with page k (default is 1). Produce k-column output (default is 1). This option should not be used with The options and are assumed for multi-column output. Produce k-column output, same as Print multi-column output across the page. This option is appropriate only with the option. Merge and print all files simultaneously, one per column (overrides the and options). Double space the output. Expand input tabs to character positions k+1, 2xk+1, 3xk+1, etc. If k is 0 or is omitted, default tab settings at every eighth position are assumed. Tab characters in the input are expanded into the appropriate number of spaces. If c (any nondigit character) is given, it is treated as the input tab character (default for c is the tab character). In output, replace white space wherever possible by inserting tabs to character positions k+1, 2xk+1, 3xk+1, etc. If k is 0 or is omitted, default tab settings at every eighth position are assumed. If c (any nondigit character) is given, it is treated as the output tab character (default for c is the tab character). Provide k-digit line numbering (default for k is 5). The number occupies the first k+1 character positions of each column of nor- mal output or each line of output. If c (any nondigit character) is given, it is appended to the line number to separate it from whatever follows (default for c is a tab). Set the width of a line to k character positions (default is 72 for equal-width, multi-column output; no limit otherwise). Width specifications are only effective for multi-columnar output. Offset each line by k character positions (default is 0). The number of character positions per line is the sum of the width and offset. Set the length of a page to k lines (default is 66). If k is less than what is needed for the page header and trailer, the option is in effect; that is, header and trailer lines are suppressed in order to make room for text. Use the next argument as the header to be printed instead of the file name. Pause before beginning each page if the output is directed to a terminal rings the bell at the terminal and waits for a Return). Use form-feed character for new pages (default is to use a sequence of line-feeds). Pause before beginning the first page if the standard output is associated with a terminal. Same as Provided for backwards compatibility. Print no diagnostic reports on failure to open files. Print neither the five-line identifying header nor the five-line trailer normally supplied for each page. Quit printing after the last line of each file without spacing to the end of the page. Separate columns by the single character c instead of by the appropriate number of spaces (default for c is a tab). EXTERNAL INFLUENCES
Environment Variables determines the interpretation of text and the arguments associated with the and options as single-byte and/or multi-byte characters. determines the format and contents of date and time strings. determines the language in which messages are displayed. If or is not specified in the environment or is set to the empty string, the value of is used as a default for each unspecified or empty variable. If is not specified or is set to the empty string, a default of (see lang(5)) is used instead of If any internationalization variable contains an invalid setting, behaves as if all internationalization variables are set to See envi- ron(5). International Code Set Support Single-byte and multi-byte character code sets are supported. RETURN VALUE
The returns the following values upon completion: Successful completion. One or more of the input files do not exist or cannot be opened. EXAMPLES
Print and as a double spaced, three column listing headed by ``file list'': Write on expanding tabs to columns 10, 19, 28, 37, ... : Print in default format with nonblank lines numbered down the left side: FILES
SEE ALSO cat(1), lp(1), nl(1), ul(1). STANDARDS CONFORMANCE
pr(1)
All times are GMT -4. The time now is 01:27 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy