Extract text between two unicode symbols using AppleScript or bash? My goal is to take text from a standard .txt document, and use (preferably) Terminal or Applescript to extract text between the symbols ▶ and •. While there is only one ▶ symbol there are multiple bullet points, so being able to extract data between only the first bullet is vital. I am partially educated in the ways of bash, so explanation would help me out a lot, otherwise I might screw up. TIA, Jake
This runs with Bash, but it evokes some Ruby code:

ruby - &lt;&lt;EOF
puts /▶[^•]*•/.match("▶the first •2•3•4•5•666643")
EOF


If you decide to use AppleScript, you have a lot of options for what to match against:

on run {input, parameters}
    set var to "▶the first •2•3•4•5•666643"

    set output to (do shell script ¬
"ruby - &lt;&lt;EOF
    puts /▶([^•]*)•/.match('" &amp; var &amp; "')[1]
EOF")

    return output
end run


Alternatively, sed can be used, which is easier for working with files:

sed -E 's/.*▶([^•]*)•.*/\1/' filename.txt