Last active
August 19, 2020 15:45
-
-
Save h8rt3rmin8r/d084e0c90ef8ba634fd17cdb09a21e2c to your computer and use it in GitHub Desktop.
Remove all types of quotation marks (includes the funky slanted quotes used by Yahoo et al) and vertical lines (pipe symbols, "|")
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env bash | |
# | |
# [ rm-charset.sh ] | |
# | |
# Remove all types of quotation marks (includes the funky slanted | |
# quotes used by Yahoo et al) and vertical lines (pipe symbols, "|") | |
# | |
# Created on 20200819 by h8rt3rmin8r (161803398@email.tg) | |
# | |
# Source: | |
# | |
# Pastebin: https://pastebin.com/raw/c2SQdUuZ | |
# Github: https://bit.ly/2Q6V3G7 | |
# | |
if [ -t 0 ]; then | |
if [[ -f "${1}" ]]; then | |
tr -s "['|\"]"[$'\u201C'$'\u201D'$'\u2018'$'\u2019'] ' ' <"${1}" | |
elif [[ ! "x${1}" == "x" ]]; then | |
tr -s "['|\"]"[$'\u201C'$'\u201D'$'\u2018'$'\u2019'] ' ' <<<"$@" | |
else | |
echo "ERROR: Missing required input (may be a file, string, or pipe)" &>/dev/stderr | |
exit 1 | |
fi | |
else | |
tr -s "['|\"]"[$'\u201C'$'\u201D'$'\u2018'$'\u2019'] ' ' | |
fi | |
exit $? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment