Archive

Posts Tagged ‘grep’

Linux Bash – sed substring

February 13th, 2009 No comments
CODE:
  1. echo "This is the TEST(Message(with some tricky word)) from which i want to search." |  <acronym title="Stream Editor">sed</acronym> 's/.*\(TEST.*))\).*$/\1/'

CODE:
  1. echo `expr match "abba (album)" '.*(\(.*\)).*'` -> album

CODE:
  1. stringZ=abcABC123ABCabc
  2. #       =======    
  3.  
  4. echo `expr match "$stringZ" '\(.[b-c]*[A-Z]..[0-9]\)'`   # abcABC1
  5. echo `expr "$stringZ" : '\(.[b-c]*[A-Z]..[0-9]\)'`       # abcABC1
  6. echo `expr "$stringZ" : '\(.......\)'`                   # abcABC1

String manipulating

17039 pages viewed, 0 today
11071 visits, 0 today
FireStats icon Powered by FireStats