Last active
June 25, 2017 20:21
-
-
Save ddmitov/9bb3a7b0920beaf68191 to your computer and use it in GitHub Desktop.
Opera Session Converter, v.0.1 will convert all your Opera session files in the current folder to plain text files with URLs only."
This file contains hidden or 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 | |
# Welcome message: | |
echo " " | |
echo "Opera Session Converter, v.0.1." | |
echo "Will convert all your Opera session files in the current folder to" | |
echo "plain text files with URLs only." | |
echo "Old files will be preserved and new files with" | |
echo "a .win.txt extension will be created." | |
echo "Input files must be without spaces!" | |
echo "Dimitar D. Mitov, 2013" | |
echo "This script is in the public domain." | |
echo " " | |
# Give some information to the user: | |
echo "Creating file list of all Opera session files in the current folder..." | |
echo " " | |
declare -a SESSION_FILES | |
SESSION_FILES=($(ls *.win)) | |
if [ "${#SESSION_FILES[@]}" = 0 ]; then | |
echo "There are no Opera session files in the current folder! Quitting." | |
echo " " | |
exit 1; | |
fi | |
# Tell the user how many files are going to be converted: | |
echo "${#SESSION_FILES[@]} files are going to be converted." | |
echo " " | |
# Give some information to the user: | |
echo "Proceeding with session files conversion..." | |
echo " " | |
# Iteration of every element of the array SESSION_FILES: | |
for FILE in "${SESSION_FILES[@]}"; do | |
echo "Converting ${FILE}..."; | |
cat ${FILE} | grep 'http://' | sed 's/^.*http/http/g' > ${FILE}.txt; | |
done | |
# Say to the user that we are ready: | |
echo " " | |
echo "Conversion successfull!" | |
echo " " |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks!