The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



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

Reply
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #8 (permalink)  
Old 6 Days Ago
jsmithstl jsmithstl is offline
Registered User
  
 

Join Date: Oct 2009
Location: St. Louis, MO
Posts: 34
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
  #9 (permalink)  
Old 6 Days Ago
abacus's Avatar
abacus abacus is offline
Registered User
  
 

Join Date: Oct 2009
Location: 41.332032,-73.089775
Posts: 20
Yes,

I think he just needs a count of the sequences that do not contain the letter J. It seems a bit more simpler now.

So a script to read in each sequence and print how many sequences with the letter J.

The example is 1. Due to 1 J sequence.

THanks again for your time and assistance.

Abacus
  #10 (permalink)  
Old 6 Days Ago
Scrutinizer Scrutinizer is offline
Registered User
  
 

Join Date: Nov 2008
Posts: 584
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
  #11 (permalink)  
Old 5 Days Ago
abacus's Avatar
abacus abacus is offline
Registered User
  
 

Join Date: Oct 2009
Location: 41.332032,-73.089775
Posts: 20
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$
Thans for your time as always.

Abacus
  #12 (permalink)  
Old 5 Days Ago
ahmad.diab's Avatar
ahmad.diab ahmad.diab is offline
Registered User
  
 

Join Date: May 2008
Location: Amman Jordan in MEA
Posts: 227
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
  #13 (permalink)  
Old 5 Days Ago
abacus's Avatar
abacus abacus is offline
Registered User
  
 

Join Date: Oct 2009
Location: 41.332032,-73.089775
Posts: 20
[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
Reply

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 02:44 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0