Skip to content

Instantly share code, notes, and snippets.

View caiofrota's full-sized avatar

Caio Frota caiofrota

View GitHub Profile
@caiofrota
caiofrota / regex_extract_string_separated_by_anything.txt
Last active November 24, 2017 19:40
Regex to extract strings separated by anything, ignoring the separator in double quotation marks.
Regex to extract strings separated by anything, ignoring the separator in double quotation marks.
("(.+)")|[^,]+ : Comma
("(.+)")|[^;]+ : Semicolon
("(.+)")|[^\.]+ : Dot
("(.+)")|[^\|]+ : Pipe
("(.+)")|[^\\]+ : Backslash
Explanation:
("(.+)") : Any string starting and ending with double quotation marks
@caiofrota
caiofrota / from_iso88591_to_utf8.sh
Last active November 24, 2017 19:40
Converting encoding with iconv command.
#!/bin/bash
for file in `find . -regextype posix-egrep -regex ".*\.(html|jsp|jspx|java|properties|xml|sql|pck|fnc|trg)"`; do
iconv -f ISO-8859-1 -t UTF-8 $file > $file.utf-8;
mv $file.utf-8 $file;
done