Search Results

Search: Posts Made By: Xterra
2,723
Posted By Don Cragun
Hi Xterra, Maybe something like: awk -v...
Hi Xterra,
Maybe something like:
awk -v genes="gene-a gene-b" \
-v lengths="3 6" \
-v strings="GCATGAAAACATACA TTTCCAGAAATTGT" '
BEGIN { nString = split(strings, String)
split(lengths,...
2,723
Posted By nezabudka
It was interesting to try to implement this...
It was interesting to try to implement this algorithm on the sed
#!/bin/sed -nrf
2~4 h
4~4 {
H;x
s/(.*GCATGAAAACATACA.{3})(.*)/\1\r\2/
}
/\r/ {
:1
s/^.(.{2}[^\r].*)/\1/
T2...
2,723
Posted By Don Cragun
Making a few wild guesses... If the output...
Making a few wild guesses... If the output you're trying to produce is:
Codon: AAC Quality Score: ,ED
Codon: TCCAAG Quality Score: G7DCGG
Codon: AAC Quality Score: GCC
Codon: TCCAAG Quality...
2,723
Posted By Don Cragun
This is probably easier to read and produces the...
This is probably easier to read and produces the same output:
awk '
BEGIN { String = "GCATGAAAACATACA"
StringLen = length(String)
}
/^@/ { getline CodonLine
getline
getline QualityLine...
2,723
Posted By Don Cragun
There are more efficient ways to do this, but...
There are more efficient ways to do this, but this seems to do what you want:
awk '
BEGIN { String = "GCATGAAAACATACA"
StringLen = length(String)
}
/^@/ { matchline = NR + 1
qualityline = NR...
11,512
Posted By RudiC
It might be worthwhile to mention that this code...
It might be worthwhile to mention that this code should be run with
- the -r flag removed
- the -n flag set
- the -fscriptname option added:


sed -nfscriptname datafile
11,512
Posted By bakunin
Yes, true - but this works only with GNU-grep,...
Yes, true - but this works only with GNU-grep, not with a standard-(POSIX-) grep because "-B" is not a POSIX-switch.

It is a hard lesson one learns in administrating very diverse large datacenters...
11,512
Posted By nezabudka
grep -x -B1 '^[^>]\{,15\}' grep -x -B1...
grep -x -B1 '^[^>]\{,15\}'
grep -x -B1 '^[^>]\{15,\}'
11,512
Posted By Don Cragun
Note that the following awk code produces both...
Note that the following awk code produces both output files you want in one invocation (with pairs with 2nd lines longer than 15 characters in a file name long and pairs with 2nd lines shorter than...
11,512
Posted By bakunin
Let us first examine why your script doesn't do...
Let us first examine why your script doesn't do what you want it to do. As a scientist you surely know that finding out why something doesn't work is as well a publishable result as is finding out...
1,955
Posted By RudiC
Can't tell. Although man awk says , it might be...
Can't tell. Although man awk says , it might be it doesn't like the caret for begin-of-line. When I modified your code snippet like in post#3, it seems to work.
1,955
Posted By RudiC
Always four lines per record? Try awk '{for...
Always four lines per record? Try
awk '{for (i=1; i<=3; i++) {getline X; $0 = $0 "\n" X}} !x[$2]++' file
@Muestra-1
agctgcgagctgcgacccgggttatataggaagagacacacacaccccc
+
...
1,420
Posted By Scrutinizer
I have no way to test it, since I have no...
I have no way to test it, since I have no Windows, but could you give this a try:
C:\cygwin64\bin\gawk -F, "NR == 1{print \"Source,Well_Source,Volume,Destination_Well,Destination\"; OFS = \",\";...
1,420
Posted By Scrutinizer
This is probably a quoting issue, which works...
This is probably a quoting issue, which works differently in Windows. Try putting the script itself in a script file :

BEGIN {
FS=","
}

NR == 1 {
print...
1,897
Posted By Scrutinizer
Try: GNU sed: sed ':a...
Try:

GNU sed:
sed ':a /^>/!N;s/\r\?\n\([^>]\)/\1/;ta' file
sed ':a /^>/!N;s/\r\{0,1\}\n\([^>]\)/\1/;ta' file
sed -r ':a 1!N;s/\r?\n([^>])/\1/;ta' file




---
Note:
The above approaches...
1,543
Posted By RudiC
There you are:awk -F, ' ...
There you are:awk -F, ' # set field separator to comma
FNR == 1 {FLNR++ ...
1,543
Posted By RudiC
OK, now that everthing is more or less clear,...
OK, now that everthing is more or less clear, let's try
awk -F, '
FNR == 1 {FLNR++
FN[FLNR] = FILENAME
next
}

{V[FLNR,...
852
Posted By RudiC
It means IF LAST2 has a value which means we're...
It means
IF LAST2 has a value which means we're at least in input line 2 (remember variables are unset thus "empty" thus FALSE at the beginning of the script; minor risk that $2 will be 0 or empty...
852
Posted By RudiC
Unfortunately I'm not at my own *nix system but...
Unfortunately I'm not at my own *nix system but on a - hrrrrgh - windows machine, so I can't test what I'm proposing here. It might still be a pointer in a desireable direction. Read and apply to...
1,676
Posted By RudiC
Slightly shorter: ls *.txt | sed -r...
Slightly shorter:
ls *.txt | sed -r 's/^(.*_)S([0-9]{1,2}_)(.*)/mv & MID-0\2\1\3/; s/-0([0-9]{2})/-\1/'
1,676
Posted By MadeInGermany
Another solution. The substitution for the two...
Another solution.
The substitution for the two digit is straight forward;
a second substitution cares about the one digit.
ls *.txt | sed '
s/\(.*_\)S\([0-9][0-9]_\)\(.*\)/mv & MID-\2\1\3/...
1,335
Posted By Don Cragun
The following was written and tested using a Korn...
The following was written and tested using a Korn shell, but will work with any POSIX-conforming shell. It does, however, depend on the version of awk that you are using allowing multi-character...
1,335
Posted By Don Cragun
Hi Xterra, I think you don't understand what is...
Hi Xterra,
I think you don't understand what is being suggested. If you have a file containing a million records, each of those records has a 1st line that is one of four values, and you want to...
1,335
Posted By RudiC
Did you even consider what Jim McNamara said and...
Did you even consider what Jim McNamara said and what I tried to cast into some sample code? Reading AND WRITING a large file multiple times - even slightly reduced in size - is unnecessary a task...
1,491
Posted By MadeInGermany
The latter has the print S within the loop, needs...
The latter has the print S within the loop, needs to be after the loop
awk ' NR==FNR { POS[++P]=$1+0; next } /^>/ { print; next } { S=sep=""; for (N=1; N in POS; N++) { S=S sep substr($0, POS[N],...
Showing results 1 to 25 of 149

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