Search Results

Search: Posts Made By: pathunkathunk
13,501
Posted By pathunkathunk
Use while loop to read file and use ${file} for both filename input into awk and as string to print
I have files named with different prefixes. From each I want to extract the first line containing a specific string, and then print that line along with the prefix.

I've tried to do this with a...
3,357
Posted By pathunkathunk
I know that I could pipe the output file and get...
I know that I could pipe the output file and get my desired output. But I would like to accomplish it all at once if possible--find matching lines in file1.txt based on the labels in labels.txt, and...
3,357
Posted By pathunkathunk
Do I have this basically right? { A[$1];...
Do I have this basically right?
{
A[$1]; # Build array on the first column of the file
next # Skip all proceeding blocks and process next line
}
$3 in A # Check in the value in column...
3,357
Posted By pathunkathunk
This successfully extracts lines with the correct...
This successfully extracts lines with the correct label. But I am looking for only two lines for each label in labels.txt, and the lines should be randomly chosen. Can this script be piped to " gshuf...
3,357
Posted By pathunkathunk
Failure using regex with awk in 'while read file' loop
I have a file1.txt with several 100k lines, each of which has a column 9 containing one of 60 "label" identifiers. Using an labels.txt file containing a list of labels, I'd like to extract 200 random...
5,979
Posted By pathunkathunk
Does the job perfectly.
Does the job perfectly.
5,979
Posted By pathunkathunk
Thank you, this works as described. If you...
Thank you, this works as described.

If you have a moment, how would I modify it if file2 has more than two columns, and I want to print all columns? The actual file2 I have has 10 columns and I'd...
5,979
Posted By pathunkathunk
Compare file1 and file2, print matching lines in same order as file1
I want to print only the lines in file2 that match file1, in the same order as they appear in file 1

file1

file2


desired output:


I'm getting the lines to match
awk 'FNR==NR...
10,517
Posted By pathunkathunk
Xargs error: insufficient space for argument
I'm trying to crudely hack my way through some data processing.

I have file.txt with around 17,000 lines like this:
ACYPI002690-PA.aa.afa.afa.trim_phyml_tree_fullnames_fullhomolog.txt 3 72 71...
3,842
Posted By pathunkathunk
bartus11, this works, thank you. It's become...
bartus11, this works, thank you. It's become clear that I need to spend some time learning perl.

Don Cragun, I am a biologist. This request is to help me parse the results of an analysis I did of...
3,842
Posted By pathunkathunk
Count number of pattern matches per line for all files in directory
I have a directory of files, each with a variable (though small) number of lines. I would like to go through each line in each file, and print the:
-file name
-line number
-number of matches to...
4,218
Posted By pathunkathunk
That does the job, thank you! (I was reading...
That does the job, thank you!

(I was reading quickly and skipped over your solution thinking it was just a quote from the previous message.)
4,218
Posted By pathunkathunk
Yes that's right. That's a better way of saying...
Yes that's right. That's a better way of saying it.
So if input is:
comp51820_c1_seq1 405 N 0:29:0:0:0:0 0:51:0:0:0:0 0:57:0:0:0:0 0:6:0:0:0:0 0:37:0:0:0:0
comp51820_c1_seq1 ...
4,218
Posted By pathunkathunk
This works to exclude the correct lines, but it...
This works to exclude the correct lines, but it also excludes a line that should be accepted (since the five sums (one from each column) are all >= 8). Desired output is:...
4,218
Posted By pathunkathunk
This works for the example file, but when I try...
This works for the example file, but when I try it with my larger file there are some issues. For example if these lines are the input:...
4,218
Posted By pathunkathunk
Thank you, this works. Would you mind also...
Thank you, this works. Would you mind also showing how I would do it if I did not want to exclude the fifth value? So just print lines where the sum of ALL values in each of columns 4-8 is at least...
4,218
Posted By pathunkathunk
If I'm not mistaken, this seems to print all...
If I'm not mistaken, this seems to print all files with at least one value >=8. I get the output:
comp51820_c1_seq1 44 N 0:0:4:0:3:1 0:0:1:9:0:0 10:0:0:0:0:0 0:3:3:2:2:6 2:2:2:5:60:3...
4,218
Posted By pathunkathunk
Sum specified values (columns) per row
Hello out there,

file.txt:
comp51820_c1_seq1 42 N 0:0:0:0:0:0 1:0:0:0:0:0 0:0:0:0:0:0 3:0:0:0:0:0 0:0:0:0:0:0
comp51820_c1_seq1 43 N 0:0:0:0:0:0 0:1:0:0:0:0 0:0:0:0:0:0 0:3:0:0:0:0 0:0:0:0:0:0...
2,160
Posted By pathunkathunk
Concatenate select lines from multiple files
I have about 6000 files of the following format (three simplified examples shown; actual files have variable numbers of columns, but the same number of lines). I would like to concatenate the ID...
2,769
Posted By pathunkathunk
Thank you for taking time on this. I actually...
Thank you for taking time on this. I actually would like the following output, so that the output sequences are in the same order as file1 (sorry, might have been confusing to also post the undesired...
2,769
Posted By pathunkathunk
Print sequences from file2 based on match to, AND in same order as, file1
I have a list of IDs in file1 and a list of sequences in file2. I can print sequences from file2, but I'm asking for help in printing the sequences in the same order as the IDs appear in file1.
...
3,325
Posted By pathunkathunk
Thanks, both of these solutions worked.
Thanks, both of these solutions worked.
3,325
Posted By pathunkathunk
sed error in UNIX but not Linux
I was using the following code successfully on a linux system.
while read pattern; do
grep -q $pattern en.pep
if [ $? -ne 0 ]; then continue; fi
line_number=`grep -m 1 -n $pattern en.pep |...
2,495
Posted By pathunkathunk
Match single line in file1 to groups of lines in file2
I have two files.

File 1 is a two-column index file, e.g.
comp11084_c0_seq6:130-468(-) comp12746_c0_seq3:140-478(+)
comp11084_c0_seq3:201-539(-) comp12746_c0_seq2:191-529(+)

File 2 is a...
1,653
Posted By pathunkathunk
This works for the example I gave, but would not...
This works for the example I gave, but would not work if the counts were 10, 11, 12, or 13. How could I specify minimum 4 rather than 4-9?

---------- Post updated at 11:33 PM ---------- Previous...
Showing results 1 to 25 of 57

 
All times are GMT -4. The time now is 07:53 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy