Search Results

Search: Posts Made By: cpp_beginner
4,698
Posted By Scrutinizer
Post #26 was about putting it in a file and...
Post #26 was about putting it in a file and running it then. Anyway I also posted the long "one liner version" of post #16 in post #29.
4,698
Posted By Scrutinizer
Could you please answer the question in post #26...
Could you please answer the question in post #26 ?

----
The post#16 on one (too long) line:
awk 'NR==FNR {R[$1,$2]=$3; next} FNR>1 {h=$1; len=length($2); print RS h; for(i=2; i<=NF; i++) {s=x;...
4,698
Posted By RudiC
Hi cpp_beginner, please be aware that asking...
Hi cpp_beginner,

please be aware that asking technical questions or requesting help via PM is highly deprecated in these fora. As is bumping up posts...
If your post / request is not answered...
4,698
Posted By Scrutinizer
Which of the two is correct? The sample file and...
Which of the two is correct? The sample file and the description contradict each other..
4,698
Posted By Scrutinizer
Yes but now your sample file2 does not match the...
Yes but now your sample file2 does not match the description. Which one is right and if it is not the sample, could you correct the sample?

And you meant 3 fields presumably, not lines ...
4,698
Posted By Scrutinizer
So that means the sample of file2 also changes? ...
So that means the sample of file2 also changes?

Also, your sample file2 is not TAB-delimited

I corrected post #16 so that it works for TAB delimited file2
Could you check the order and if the...
4,698
Posted By Scrutinizer
Yes as I mentioned, it will only work with single...
Yes as I mentioned, it will only work with single sequence line FASTA.
Try this instead, which should no work with a wrapped (multi-line) FASTA sequence:
awk '
NR==FNR {
R[$1,$2]=$3
...
4,698
Posted By RudiC
This is NOT what you specified in post#1: ...
This is NOT what you specified in post#1:

Data_1 2 Z
Data_1 3 T
Data_1 10 A
Data_1 11 T
4,698
Posted By Scrutinizer
I think that is too long. The Fasta format allows...
I think that is too long. The Fasta format allows wrapping of the sequence over multiple lines. That should be an option in the program you used to generate the file with.

Please indicate if you...
13,299
Posted By Corona688
You are comparing them as strings, not numbers. ...
You are comparing them as strings, not numbers. Convert $2 to a number by adding 0 to it, and don't quote your own value.
awk '($2 + 0) < 1E-10' inputfile
You don't need a { print $0 } block. If...
1,134
Posted By Don Cragun
You could also try something like: awk ' $1...
You could also try something like:
awk '
$1 == "pattern1" { Found1 = 1; Save1 = $0; next }
Found1 && $1 == "pattern2" { print Save1 ORS $0 }
{ Found1 = 0 }
' file
which would seem to be...
1,134
Posted By RavinderSingh13
Hello cpp_beginner, Could you please try...
Hello cpp_beginner,

Could you please try following and let me know if this helps.

awk '{C++} /pattern1/{B=$0;D=C} /pattern2/{D++;if(D==C){print B ORS $0}}' Input_file


Output will be as...
1,259
Posted By SriniShoo
awk '{n = gsub("miR", "&1", $3); $0 = $0 " " n}1'...
awk '{n = gsub("miR", "&1", $3); $0 = $0 " " n}1' file
1,790
Posted By Don Cragun
You could try something like: awk ' function...
You could try something like:
awk '
function chk() {
l1 = $3 < $4 ? $3 : $4
l2 = $3 > $4 ? $3 : $4
return(l1 < low1 || (l1 == low1 && l2 < low2))
}
function sav(sl1,...
1,790
Posted By Subbeh
Here is another approach: awk '{x=$3<$4?$3:$4;...
Here is another approach:
awk '{x=$3<$4?$3:$4; i=i?i:x ;if(x<=i){i=x; s=$0}} END{print s}' file
1,790
Posted By Klashxx
Quick dirty awk: awk...
Quick dirty awk:
awk 'NR==1{L=$NF<$(NF-1)?$NF:$(NF-1)}$(NF-1)<= L{L=$(NF-1);t=$0};$NF<=L{L=$NF;t=$0}END{print t}' infile
1,714
Posted By RudiC
man sort: so it sorts using field 1 char 4...
man sort: so it sorts using field 1 char 4 numerical as the first sort key. To be very precise, and avoid side effects, you would need to modify it to k1.4,1n
1,714
Posted By RudiC
Combining both your proposals should do the job:$...
Combining both your proposals should do the job:$ sort -k1.4n -k2,2g -k3,3r file
ID_1 0E0 6578
ID_1 0E0 5434
ID_1 0E0 3254
ID_1 5E-52 46437
ID_1 1E-14 2524
ID_3 65E-20 45467
ID_5 0E0 436...
2,882
Posted By RudiC
With your sample file from post#1:awk 'BEGIN...
With your sample file from post#1:awk 'BEGIN {ULON="\033[4m"; RST="\033[0m"}
{$3 = substr($3,1,$1-1) ULON substr($3,$1,$2-$1+1) RST substr($3,$2+1)}
1
' file
2...
2,882
Posted By mjf
If you choose the Excel route, here is an...
If you choose the Excel route, here is an "untested" example of how to do such using VBA in Excel:

If cell A1 contains the starting point, cell B1 contains the ending proint and
the string is...
2,882
Posted By mjf
cpp_beginner, If you will be importing the text...
cpp_beginner,
If you will be importing the text file into Excel, one solution would be to write an Excel formula or some VBA code to handle the underlining part.
1,136
Posted By ctsgnb
try this nawk '{y=x;x=$1}x==y{sub($1,"")}1'...
try this
nawk '{y=x;x=$1}x==y{sub($1,"")}1' yourfile
1,136
Posted By vivek d r
here is your code :-) first=" " while...
here is your code :-)

first=" "
while read line
do
first2=$( echo $line | awk -F' ' '{print $1}' )
if [[ "$first" == "$first2" ]]
then
gg=$( echo...
1,136
Posted By itkamaraj
$ nawk '{print $1}' test | sort -u | while read...
$ nawk '{print $1}' test | sort -u | while read a; do grep $a test | nawk '{if(NR>1){printf("\t%s\t%s\n",$2,$3)}else{print $0}}'; done
ABC-B data17_input1 3466
data17_input2...
1,835
Posted By durden_tyler
Maybe something like this? $ $ $ cat...
Maybe something like this?


$
$
$ cat f26
dependent general_process
dependent general_process
regulation general_process
- -
template component
food component
binding ...
Showing results 1 to 25 of 58

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