Home > Ideo page, Malo mešano > Linux Bash – sed substring

Linux Bash – sed substring

February 13th, 2009 Leave a comment Go to 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

  1. No comments yet.
  1. No trackbacks yet.

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