keep only pairs


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting keep only pairs
# 8  
Old 05-11-2012
Thanks Corona688, wondering why didnt I think of that Smilie
Code:
paste file1 file2 | awk 'NF>1'

This seems to work as I want Smilie

@jlliagre- Thanks, seems to run on cygwin Smilie thanks a lot!!
# 9  
Old 05-11-2012
Quote:
Originally Posted by jamie_123
@jlliagre- Thanks, seems to run on cygwin Smilie thanks a lot!!
You're welcome. It should not only work on cygwin but on any Unix/Linux. Corona688 way is definitely much simpler. One advantage of mine is it handles multi-column input files correctly, just like paste is doing.
# 10  
Old 05-11-2012
Ya, this seems to be more sophisticated in some ways Smilie
in that case why did you mention solaris/nawk as a requirement?? Just curious.
# 11  
Old 05-11-2012
Quote:
Originally Posted by jamie_123
in that case why did you mention solaris/nawk as a requirement?? Just curious.
Sorry about the confusion. I didn't mentioned Solaris/nawk as a requirement, just that if you are on Solaris, then you need to use nawk instead of awk. Otherwise, you can just use my script as it is.
# 12  
Old 05-11-2012
aah, okay Smilie
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Sorting by pairs

Can sort sort by pair of lines? infile: ID 15 GNJSMKSNS ID 25 GNJSMKSNS ID 1 GNJSMKSNS outfile: ID 1 GNJSMKSNS ID 15 GNJSMKSNS ID 25 GNJSMKSNS sort -grk 2 obviously does not work (4 Replies)
Discussion started by: Xterra
4 Replies

2. 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

3. Shell Programming and Scripting

Running a diff on all pairs of arguments

I would like to create a loop and an inner loop to do a diff command on each pair of files passed as arguments. For example, if four files were on the command line, a diff would run on 1-2, 1-3, 1-4, 2-3, 2-4, & 3-4. Thus far I know the $# will give the count of the arguments and argv (instead of... (4 Replies)
Discussion started by: wbport
4 Replies

4. 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

5. 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

6. Shell Programming and Scripting

Looping through pairs of files with awk

Hi all, please help me construct the command. i want to loop through all files named bam* and bed*. My awk works for a particular pair but there are too many pairs to do manually. I have generated multiple files in a folder in a given pattern. The files are named like bam_fixed1.bam... (2 Replies)
Discussion started by: newbie83
2 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

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

9. 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

10. Shell Programming and Scripting

perl search and replace pairs

Hello all im facing some kind of problem i have this string : functionA() $" "$ functionB("arg1") $" = "$ i will like to replace all the pairs of opening and closing "$" to be something like that functionA() <#" "#> functionB("arg1") <#" = "#> i cant of course do is with simple ... (1 Reply)
Discussion started by: umen
1 Replies
Login or Register to Ask a Question