substring="trajectory"
##================================================
index="$(echo $f | grep -b -o $substring | sed 's/:.*$//')" # redirecting the output of echo into a variable with "$(...)"
#echo $index
model_name=${f:0:$((index-1))} # taking the substring 0-(index-1)
echo "model_name : "$model_name
##=================================================
# find the 'trajectory_id'
#expr index "$f" trajectory
#echo $index
trajectory_id=${f#*$substring} # find the occurrence of $substring in $f
#echo $f
#echo $trajectory_id
len=$((${#trajectory_id}-4)) # arithmatic operation with $((.)) excluding the .txt extension
#echo "length is "$len
trajectory_id=${trajectory_id:0:$len}
echo "trajectory_id : "$trajectory_id
Reference
Reference
Subscribe to:
Post Comments (Atom)
Carlo Cipolla's Laws of Stupidity
"By creating a graph of Cipolla's two factors, we obtain four groups of people. Helpless people contribute to society but are...
-
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...
-
"By creating a graph of Cipolla's two factors, we obtain four groups of people. Helpless people contribute to society but are...
-
Use 'Disk Utility' application to format the USB drive in MS-DOS (FAT) format Download the windows ISO file from the Windows websit...
No comments:
Post a Comment