simX
Unofficial Mac Genius
How do I get awk to split a string after/before a certain character?
For example, if I have the string "9+(8+9+(6+4))", I want awk to split it into "9+", "(8+9+", "(6+4)", ")".... that is, I want awk to split the string BEFORE an open parenthesis, and AFTER a close parenthesis.
How would I accomplish that? Of course, I want it to output to standard out (Terminal window), so that I can use this command in an AppleScript.
Another question: if I have a string like "3982ldlsieK3829", how would I have awk split the string after the first string of numbers? I don't want it to split after each number, but after each string of numbers. I also don't want it to split up the letters. The result from the above string should be "3982","ldlsieK","3829" (on different lines, of course).
Thanks for any help!
For example, if I have the string "9+(8+9+(6+4))", I want awk to split it into "9+", "(8+9+", "(6+4)", ")".... that is, I want awk to split the string BEFORE an open parenthesis, and AFTER a close parenthesis.
How would I accomplish that? Of course, I want it to output to standard out (Terminal window), so that I can use this command in an AppleScript.
Another question: if I have a string like "3982ldlsieK3829", how would I have awk split the string after the first string of numbers? I don't want it to split after each number, but after each string of numbers. I also don't want it to split up the letters. The result from the above string should be "3982","ldlsieK","3829" (on different lines, of course).
Thanks for any help!