![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| An urgent assistance | kinny | Shell Programming and Scripting | 5 | 3 Weeks Ago 07:08 AM |
| rsync assistance | SteveMosher | UNIX for Advanced & Expert Users | 4 | 09-21-2009 01:48 PM |
| I need an assistance | mytilini boy | Shell Programming and Scripting | 1 | 05-25-2007 08:42 PM |
| Need Assistance | yahoo14 | UNIX for Dummies Questions & Answers | 1 | 06-08-2006 10:21 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
I see... I think.... A sequence includes all the lines between the headers?
|
| Bits Awarded / Charged to jsmithstl for this Post | |||
| Date | User | Comment | Amount |
| 5 Days Ago | abacus | Thank you for your assistance... | 10,000 |
|
||||
|
Something like this then?
Code:
awk '/^>/{if(s==1)t++;s=1;next} /J/{s=0} END{if(s==1)t++;print "J-less sequences: "t}' infile
|
| Bits Awarded / Charged to Scrutinizer for this Post | |||
| Date | User | Comment | Amount |
| 5 Days Ago | abacus | Thank you for your time and expertise.... | 10,000 |
|
|||||
|
Hmm,
OSX Snow Leopard tested. Code:
machine1:~ jasonralph$ awk '/^>/{if(s==1)t++;s=1;next} /J/{s=0} END{if(s==1)t++;print "J-less sequences: "t}' infile
J-less sequences:
c-machine1:~ jasonralph$
Abacus |
|
|||||
|
you can know the number of sequences that have J on it on each description, then you can grep the zero or write if condition grep the "0" values counter.
Code:- Code:
gawk '
/^>/{ t=$0 ; a[t]=0 ;next}
/J/{a[t]++ }
END{ for ( i in a ) { printf "J exist in %s sequence(s) of header %s\n",a[i],i } }
' input_file
Code:
Output J exist in 2 sequence(s) of header >description 1-blah blah blah J exist in 1 sequence(s) of header >description 2-blah blah blah ![]() ![]() ![]() ![]() |
| Bits Awarded / Charged to ahmad.diab for this Post | |||
| Date | User | Comment | Amount |
| 5 Days Ago | abacus | Thank You Sir, | 10,000 |
|
|||||
|
[solved]
Thanks to ahmad.diab, scruitinizer and jsmithstl. The code examples that you have all provided have done the trick.
My friend and I are very satisfied with the level of professionalism found on this site by the users. Abacus |
| Sponsored Links | ||
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|