Skip to content

Instantly share code, notes, and snippets.

@ddmitov
Last active June 25, 2017 20:21
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ddmitov/9bb3a7b0920beaf68191 to your computer and use it in GitHub Desktop.
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."
#!/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 " "
@nahueloyha
Copy link

Thanks!

@ddmitov
Copy link
Author

ddmitov commented Jun 25, 2017

You are welcome!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment