On Mon, Oct 20, 2008 at 05:04:40PM -0500, Robert Citek wrote:
> 
> I think I'm overlooking something simple.  I have a bunch of ID
> numbers and I want to replace all occurances of numbers that are NOT
> 1-4 with an x.  However, both of these solutions give me the same
> anser:
> 
> $ echo '12345' |  perl -plne 'y/[1234]/x/'
> xxxx5
> 
> $ echo '12345' |  perl -plne 'y/[^1234]/x/'
> xxxx5

I don't think any one addresses the perl oddity.  From perlop(1)

   Note that "tr" does not do regular expression character classes
   such as "\d" or "[:lower:]". The <tr> operator is not
   equivalent to the tr(1) utility.  If you want to map strings between
   lower/upper cases, see "lc" in perlfunc and "uc" in perlfunc,
   and in general consider using the "s" operator if you need regular
   expressions.

-- 
David Dooling
http://www.politigenomics.com/

--~--~---------~--~----~------------~-------~--~----~
Central West End Linux Users Group (via Google Groups)
Main page: http://www.cwelug.org
To post: [email protected]
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
More options: http://groups.google.com/group/cwelug
-~----------~----~----~----~------~----~------~--~---

Reply via email to