Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

named character classes in grep

 
Minal Silimkar-Urankar
Ranch Hand
Posts: 136
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to know how to use named charactes classes with grep command?
 
Tim Holloway
Saloon Keeper
Pie
Posts: 18169
53
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Character-class pattern for USA format date string (MM/DD/YYYY):

[:digit:][:digit:]/[:digit][:digit:]/[:digit:]{4}

Which is equivalent to

\d\d/\d\d/\d{4}

Or \d{2}/\d{2}\/d{4}

Except that character classes may be more locale-sensitive, if I understood them correctly.

Another benefit of the named classes is that backslashes can bite.
[ April 18, 2008: Message edited by: Tim Holloway ]
 
Minal Silimkar-Urankar
Ranch Hand
Posts: 136
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How can I use the named character constants with grep command?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic