Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SHELL

bash replace beginning of string

$ cat shortest.sh
#! /bin/bash

filename="bash.string.txt"

echo ${filename#*.}
echo ${filename%.*}

$ ./shortest.sh
After deletion of shortest match from front: string.txt
After deletion of shortest match from back: bash.string
Source by www.thegeekstuff.com #
 
PREVIOUS NEXT
Tagged: #bash #replace #beginning #string
ADD COMMENT
Topic
Name
2+2 =