Search Results

Search: Posts Made By: daashti
2,416
Posted By Don Cragun
Yes, the code above should work. In this...
Yes, the code above should work. In this specific case (i.e., >0), you could further simplify the lines:
(CM > 0) && !CR ||
(CR > 0) && !CM ||
NR == 1
to:
CM && !CR ||
CR && !CM ||
NR == 1...
2,416
Posted By RudiC
You mean ONE or more homo AND NO hetero or NO...
You mean ONE or more homo AND NO hetero or NO homo AND ONE or more hetero? Then, yes, that's how you do it.
I have to admit, using >= 2 (or, in your second case, 1 ) would make the logics way...
2,416
Posted By RudiC
Please become accustomed to provide decent...
Please become accustomed to provide decent context info of your problem.
It is always helpful to support a request with system info like OS and shell, related environment (variables, options),...
5,707
Posted By Don Cragun
One could also try: sed...
One could also try:
sed 's,0/1[^[:space:]]*,homo,g
s,1/1[^[:space:]]*,hetero,g' file
If all of your fields are <tab> separated and some fields might contain <space>s, replace each occurrences of...
5,707
Posted By Corona688
sed does not understand fields / columns without...
sed does not understand fields / columns without a lot of effort, awk can loop through them.

Loop starts at 6 for efficiency, if the 0/1 can come in any field change it to 1.

$ awk -F"\t" -v...
3,790
Posted By Aia
Your file shows what we suspected. It is a file...
Your file shows what we suspected. It is a file that have been saved from a msdos operating system. It needs to be converted to Unix like format, first.

perl -nle 's/\r$//; /SF=(\d+)/; print if $1...
3,790
Posted By Aia
Sure, but any value greater than 400 would be...
Sure, but any value greater than 400 would be always 3 digits (or more) and if the maximum number is 818 a three digit is sufficient.
A variation, if the maximum number could be arbitrary.
perl...
1,953
Posted By RudiC
Yes. Look at the code and how it loops across...
Yes. Look at the code and how it loops across fields 10 until end-of-line. Now imagine what were needed to make it loop across fields 1 to 9...
1,953
Posted By RudiC
Assuming "letters" stands for "characters", and...
Assuming "letters" stands for "characters", and interpreting your desired output like "remove everything in a field after the first colon", and using <TAB> as the output field separator, would this...
1,953
Posted By Don Cragun
Please also explain what you mean by "remove al...
Please also explain what you mean by "remove al letters after : character". The sample data you provided did not contain any letters in the fields you specified and instead of removing letters after...
Showing results 1 to 10 of 10

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