String split:
-------------------
#!/bin/bash
f="egan#mcclave"
substring="#"
##===========================================================================
# find the 'model_name'
index="$(echo $f | grep -b -o $substring | sed 's/:.*$//')" # redirecting the output of echo into a variable with "$(...)"
#echo $index
first=${f:0:$((index))} # taking the substring 0-index
echo "first : "$first
second=${f#*$substring} # find the occurrence of $substring in $f
echo "second : "$second
Subscribe to:
Post Comments (Atom)
-
To install pngwrite we need to install to helper library before we install pngwriter. 1. libpng 2. freetype2 We can use fink or macport to i...
-
Parsing and displaying dates and times is often complicated because of formatting and locale issues. Java 2 Platform, Standard Edition (J2S...
No comments:
Post a Comment