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 > UNIX for Dummies Questions & Answers
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #7 (permalink)  
Old 12-04-2008
naughty21 naughty21 is offline
Registered User
  
 

Join Date: Jun 2008
Posts: 16
Quote:
Originally Posted by joeyg View Post
Code:
> echo `echo "<EmailAddress>abc@gmail.com</EmailAddress>" | tr ">" "\n" | tr "<" "\n" | grep "@" | wc -c`
14
Note that I am off by one character as the echo gives a new-line.
Thus...

Code:
> echo `echo "<EmailAddress>abc@gmail.com</EmailAddress>" | tr ">" "\n" | tr "<" "\n" | grep "@" | wc -c` -1 | bc
13
or

Code:
> echo "<EmailAddress>abc@gmail.com</EmailAddress>" | tr ">" "\n" | tr "<" "\n" | grep "@" | tr -d "\n" | wc -c
13
thanks for your reply

but if we dont know what is there in between tags then how can we do means if we dont know/we didnt see the email id which is in between tags

for ex: EmailAddress>-------</EmailAddress>" in this ---- is nothing but some email id