Sponsored Content
Full Discussion: Sorting by pairs
Top Forums UNIX for Dummies Questions & Answers Sorting by pairs Post 302949613 by Xterra on Monday 13th of July 2015 11:47:55 PM
Old 07-14-2015
This is what I was looking for
Code:
 awk '{printf("%s%s",$0,(NR%2)?"\t":"\n")}' input|sort -rk 3|tr '\t' '\n'

Could you please explain me the following parts of the code:
"%s%s"
?
:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

PERL name value pairs substituions

I have a main file with variable tokens like this: name: File1 =========== Destination/Company=@deploy.company@ Destination/Environment=@deploy.env@ Destination/Location=@deploy.location@ Destination/Domain=@deploy.location@ MIG_GatewayAddresses=@deploy.gwaddress@ MIG_URL=@deploy.mig_url@... (1 Reply)
Discussion started by: uandme2k2
1 Replies

2. Shell Programming and Scripting

concatenate lines in pairs

Hi, I have a text file with the following contents /C=IT/O=INFN/OU=Personal Certificate/L=Napoli/CN=Some guy /C=IT/O=INFN/CN=INFN CA /O=Grid/O=NorduGrid/OU=uninett.no/CN=Another guy /O=Grid/O=NorduGrid/CN=NorduGrid Certification Authority /C=TW/O=AP/OU=GRID/CN=Someone else... (5 Replies)
Discussion started by: kerl
5 Replies

3. Shell Programming and Scripting

How to swap order of pairs of lines?

This seems to be a question whose answer uses sed or awk. For a file like: a b c d e How to swap the order of the line pairs, to end up with: b a d c e All lines from the original file need to wind up in the output file. (8 Replies)
Discussion started by: rd5817
8 Replies

4. UNIX Desktop Questions & Answers

trying to cat multiple pairs of files

I have a number of files in a directory named like this: fooP1, fooN1, fooP2, fooN2 ... fooP(i), fooN(i). I'd like to know how to combine each P and N pair into a single file, foo(i) TIA John Balwit (1 Reply)
Discussion started by: balwit
1 Replies

5. Shell Programming and Scripting

keep only pairs

Hi, I am trying to paste together two files which are like this- 1 2 4 and 2 3 4 The paste command would work by default for this case, but when there are cases where the number of entries are different in each file. for eg: 1 3 and 1 3 4 I want to make it such that the odd... (11 Replies)
Discussion started by: jamie_123
11 Replies

6. Shell Programming and Scripting

extracting non-zero pairs of numbers from each row

Hi all, I do have a tab delimited file a1 a2 b1 b2 c1 c2 d1 d2 e1 e2 f1 f2 0 0 123 546 0 0 0 0 0 0 0 0 0 0 345 456 765 890 902 1003 0 0 0 0 534 768 0 0 0 0 0 0 0 0 0 0 0 0 0 0 456 765 0 0 0 0 0 0 0 0 0 0 0 0 12 102 0 0 0 0 456 578 789 1003 678 765 345 400 801 1003 134 765... (5 Replies)
Discussion started by: Lucky Ali
5 Replies

7. UNIX for Dummies Questions & Answers

Remove Duplicate Two Line Pairs?

So I have a bunch of files that look like this >gi|33332323 MMKCRGVIMVVEKVMKRDGRIVPFDESRIRWAVQ--- >gi|45235353 MMKCR----VEKMRDVFFDESIRWAVQ They go on...sequences are much longer but all in two line (fasta) format. I want to remove duplicate pairs of ID(GI) number and sequence. I tried... (12 Replies)
Discussion started by: bakere19
12 Replies

8. Shell Programming and Scripting

Extracting key/value pairs in awk

I am extracting a number of key/value pairs in awk using following: awk ' /xyz_session_id/ { n=index($0,"xyz_session_id"); id=substr($0,n+15,25); a=$4; } END{ for (ix in a) { print a } }' I don't like this Index + substr with manually calculated... (5 Replies)
Discussion started by: migurus
5 Replies

9. Shell Programming and Scripting

Looping through files in pairs

Hi all, Please guide. It has to do with parsing the input file names. I have a fairly large number of files, I want to do some operations on them in a pairwise fashion (every file has a pair). The names are in the following pattern, with the pairs of files named with _1 and _2 , the... (4 Replies)
Discussion started by: newbie83
4 Replies

10. UNIX for Dummies Questions & Answers

Concatenate files by pairs

Hi, I would like to batch concatenate files by pairs. I have quite a few of them so I would not like to do that pair by pair separately. the names of the file is of the type: file1.fastq newfile1_new.fastq file2.fastq newfile2_new.fastq and so on... I would like to concatenate file1... (2 Replies)
Discussion started by: jawad
2 Replies
SC_ALLY(1)						    BSD General Commands Manual 						SC_ALLY(1)

NAME
sc_ally -- scamper driver to run Ally on a list of candidate aliases. SYNOPSIS
sc_ally [-?D] [-i infile] [-o outfile] [-p port] [-U unix-socket] [-w waittime] [-q attempts] [-t logfile] DESCRIPTION
The sc_ally utility provides the ability to connect to a running scamper(1) instance and have a set of IPv4 address-pairs testsed for aliases using the Ally technique. For each address pair in the file, sc_ally establishes which probe methods (UDP, TCP-ack, ICMP-echo) solicit an incrementing IP-ID value, and then uses the Ally technique on pairs where a probe method is able to obtain an incrementing IP-ID for both addresses. The output is written to a warts file. The options are as follows: -? prints a list of command line options and a synopsis of each. -D causes sc_ally to detach and become a daemon. -i infile specifies the name of the input file which consists of a sequence of IPv4 address-pairs, one pair per line. -o outfile specifies the name of the output file to be written. The output file will use the warts format. -p port specifies the port on the local host where scamper(1) is accepting control socket connections. -U unix-socket specifies the name of a unix domain socket where scamper(1) is accepting control socket connections. -w waittime specifies the minimum length of time, in seconds, to wait between completing a measurement to a particular IP address and issuing the next. -q attempts specifies the number of times to try Ally when one of the addresses is unresponsive. -t logfile specifies the name of a file to log output from sc_ally generated at run time. EXAMPLE
Given a set of IPv4-address pairs in a file named infile.txt: 192.0.2.1 192.0.32.10 192.0.2.2 192.0.31.8 192.0.2.3 192.0.30.64 and a scamper(1) daemon listening on port 31337, then these address-pairs can be tested for aliases using sc_ally -i infile.txt -o outfile.warts -p 31337 SEE ALSO
N. Spring, R. Mahajan, and D. Wetherall, Measuring ISP topologies with Rocketfuel, Proc. ACM SIGCOMM 2002. scamper(1), sc_wartsdump(1), sc_warts2text(1) AUTHORS
sc_ally is written by Matthew Luckie <mjl@luckie.org.nz>. BSD
March 1, 2011 BSD
All times are GMT -4. The time now is 01:09 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy