Tumblelog by Soup.io
Newer posts are loading.
You are at the newest post.
Click here to check if anything new just came in.

January 17 2010

August 04 2009

Anton Olsen.com » Blog Archive » BASH: Split a string without ‘cut’ or ‘awk’

For a little test script I’m writing I needed to split a line on a ‘;’ but preservere the “s and ’s, something that echo doesn’t like to do. Digging deeper into the bash docs I see that there are some handy string handling functions. #!/bin/bash line=’this “is” a command;this “is” a pattern’ COMMAND=${line%;*} PATTERN=${line#*;} echo $COMMAND echo $PATTERN
Older posts are this way If this message doesn't go away, click anywhere on the page to continue loading posts.
Could not load more posts
Maybe Soup is currently being updated? I'll try again automatically in a few seconds...
Just a second, loading more posts...
You've reached the end.

Don't be the product, buy the product!

Schweinderl