aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/%HOME%/.bash_utils/text.sh
diff options
context:
space:
mode:
Diffstat (limited to '%HOME%/.bash_utils/text.sh')
-rw-r--r--%HOME%/.bash_utils/text.sh95
1 files changed, 0 insertions, 95 deletions
diff --git a/%HOME%/.bash_utils/text.sh b/%HOME%/.bash_utils/text.sh
index e4e5929..ea5b1af 100644
--- a/%HOME%/.bash_utils/text.sh
+++ b/%HOME%/.bash_utils/text.sh
@@ -123,26 +123,6 @@ str_replace() (
echo "${str//$sub/$rep}"
)
-str_tolower() (
- set -o errexit -o nounset -o pipefail
- shopt -s inherit_errexit
-
- local s
- for s; do
- echo "${s,,}"
- done
-)
-
-str_toupper() (
- set -o errexit -o nounset -o pipefail
- shopt -s inherit_errexit
-
- local s
- for s; do
- echo "${s^^}"
- done
-)
-
_bash_escape_pattern() (
set -o errexit -o nounset -o pipefail
shopt -s inherit_errexit
@@ -295,78 +275,3 @@ str_join() (
done
echo
)
-
-str_grep() (
- set -o errexit -o nounset -o pipefail
- shopt -s inherit_errexit
-
- if [ "$#" -ne 1 ]; then
- echo "usage: ${FUNCNAME[0]} PATTERN" >&2
- return 1
- fi
-
- local pattern="$1"
-
- find . -type f -exec grep --fixed-strings --binary-files=without-match --regexp="$pattern" -- {} +
-)
-
-str_grep_word() (
- set -o errexit -o nounset -o pipefail
- shopt -s inherit_errexit
-
- if [ "$#" -ne 1 ]; then
- echo "usage: ${FUNCNAME[0]} PATTERN" >&2
- return 1
- fi
-
- local pattern="$1"
-
- find . -type f -exec grep --basic-regexp --binary-files=without-match --regexp="\b$pattern\b" -- {} +
-)
-
-str_iconv_fromto() (
- set -o errexit -o nounset -o pipefail
- shopt -s inherit_errexit
-
- if [ "$#" -lt 3 ]; then
- echo "usage: ${FUNCNAME[0]} SRC_ENCODING DEST_ENCODING PATH..." >&2
- return 1
- fi
-
- local src_encoding="$1"
- shift
- local dest_encoding="$1"
- shift
-
- local path path_dir tmp_path rm_tmp_path
-
- for path; do
- path_dir="$( dirname -- "$path" )"
- tmp_path="$( mktemp -- "$path_dir/${FUNCNAME[0]}_XXX" )"
- if iconv --from-code="$src_encoding" --to-code="$dest_encoding" -- "$path" > "$tmp_path"; then
- mv -f -- "$tmp_path" "$path"
- else
- rm -f -- "$tmp_path"
- return 1
- fi
- done
-)
-
-str_iconv() (
- set -o errexit -o nounset -o pipefail
- shopt -s inherit_errexit
-
- if [ "$#" -lt 2 ]; then
- echo "usage: ${FUNCNAME[0]} DEST_ENCODING PATH..." >&2
- return 1
- fi
-
- local dest_encoding="$1"
- shift
-
- local src_encoding path
- for path; do
- src_encoding="$( file --brief --mime-encoding -- "$path" )"
- str_iconv_fromto "$src_encoding" "$dest_encoding" "$path"
- done
-)