View Single Post
  #2   (View Single Post)  
Old 4th September 2008
J65nko J65nko is offline
Administrator
 
Join Date: May 2008
Location: Budel - the Netherlands
Posts: 4,128
Default

See the expr(1) man page
Code:
$ text=ThisIsMyDumbTextLine
$ expr $text : '\(.....\)'
ThisI

$ expr $text : '.*\(.....\)$'
tLine

$ expr $text : '.*'
20
The Midstring function:
Code:
$ text='1234567890'
$ expr $text : '.\{4\}\(.\{5\}\)' 
56789.
__________________
You don't need to be a genius to debug a pf.conf firewall ruleset, you just need the guts to run tcpdump

Last edited by J65nko; 4th September 2008 at 10:19 PM. Reason: Midstring equivalent added
Reply With Quote