Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- #BANNER
- echo -e "\e[1m .--.----------------."
- echo " / \ \ \ \ \ \ \ \ \ "
- echo -E " / \ \ "
- echo -E " / \ \ "
- echo -E " / | |"
- echo -E " | d8b | |"
- echo -E " | d888b || | | | | | | | |"
- echo -E " | 88888 || | | | | | | | |"
- echo -E " | Y888P | |"
- echo -E " \ Y8P | |"
- echo -E " \ // /"
- echo -E " \ // /"
- echo -E " \ /| | | | | | | | ||"
- echo -E " --- || | | | | | | | |"
- echo -E " \ \ "
- echo -E " \ \ "
- echo -e " \ \e[1;36mASSCLEANER\e[0m \ "
- echo -E " \ \ "
- echo -E " \ \ \ \ \ \ \ \ \ "
- echo -e " \................\ \e[0m"
- echo ""
- echo -e " ______________________________"
- echo -e " | - \e[1;36mSENTRY.MBA § COMUNNITY\e[0m - |"
- echo -e " | |"
- echo -e " | **************************** |"
- echo -e " | ▬▬ι═══════- ☯ -═══════ι▬▬ |"
- echo -e " | \e[36;3;1mBy BISHA\e[0m \e[0m|"
- echo -e " | **************************** |"
- echo -e " |______________________________|"
- echo ""
- echo ""
- INICIO=0
- while [ $INICIO -ne 3 ];do
- echo -e "\e[1;36m[-] Choose an option:\e[0m"
- echo "[1] Start"
- echo "[2] Help"
- echo "[3] Exit"
- read INICIO
- if [ $INICIO == 1 ];then
- echo ""
- echo -e "\e[1;36m[-] Load file:\e[0m"
- read -e ARCHIVO
- echo ""
- echo -e "\e[1;36m[-] Choose an option:\e[0m"
- echo "[1] Replace"
- echo "[2] Filter"
- echo "[3] Delete to"
- echo "[4] Count lines"
- echo "[5] Split up"
- echo "[6] Remove duplicates"
- read OPCION
- echo ""
- if [ $OPCION == 1 ];then
- echo "[-] Enter string to be replaced:"
- read TERM1
- echo "[-] Enter substitution string:"
- read TERM2
- echo ""
- elif [ $OPCION == 2 ];then
- echo -e "\e[1;36m[-] Choose type of search:\e[0m"
- echo "[1] Normal search"
- echo "[2] Negative search"
- read SEARCH
- if [ $SEARCH == 1 ];then
- echo ""
- echo "[-] Enter filter:"
- read FILTRO
- echo ""
- elif [ $SEARCH == 2 ];then
- echo ""
- echo "[-] Enter filter:"
- read FILTRO
- echo ""
- else
- echo -e "\e[0;36m\e[1mYou must choose a valid option, nibba.\e[0m"
- echo ""
- exit
- fi
- elif [ $OPCION == 3 ];then
- echo "[-] Enter string or character:"
- read FINAL
- echo ""
- elif [ $OPCION == 5 ];then
- echo -e "\e[1;36m[-] Divide the file:\e[0m"
- echo "[1] By number of files"
- echo "[2] By size"
- read SPLIT
- echo ""
- elif [ $OPCION == 4 ];then
- echo ""
- elif [ $OPCION == 6 ];then
- echo ""
- else
- echo ""
- echo -e "\e[0;36m\e[1mYou must choose a valid option, nibba.\e[0m"
- echo ""
- exit
- fi
- echo "[-] Delete null lines? Y/N"
- read LINEA
- echo ""
- echo "[-] Delete blank spaces? Y/N"
- read ESPAC
- echo ""
- echo ""
- echo "[-] Debugging file: " $ARCHIVO"..."
- echo ""
- echo ""
- echo -e "\e[1;36m----------------------- Running -----------------------\e[0m"
- echo ""
- echo "" > cleancombo.txt
- if [ $OPCION == 1 ];then
- echo "[-] Substituting strings..."
- sed 's/'$TERM1'/'$TERM2'/g' $ARCHIVO > cleancombo.txt
- elif [ $OPCION == 2 ];then
- if [ $SEARCH == 1 ];then
- echo "[-] Filtering lines using string" $FILTRO"..."
- grep $FILTRO $ARCHIVO > filteredcombo.txt
- elif [ $SEARCH == 2 ];then
- echo "[-] Filtering lines using string" $FILTRO"..."
- grep -v $FILTRO $ARCHIVO > filteredcombo.txt
- fi
- elif [ $OPCION == 3 ];then
- echo "[-] Deleting content of lines until" $FINAL"..."
- sed 's/.*['$FINAL']//' $ARCHIVO > cleancombo.txt
- elif [ $OPCION == 4 ];then
- echo "[-] Counting lines..."
- echo -e "\e[1m[-] Number of lines:\e[0m" `wc -l $ARCHIVO`
- elif [ $OPCION == 5 ];then
- if [ $SPLIT == 1 ];then
- echo -e "\e[1;36m[-] Enter the number of files for output:\e[0m"
- read NF
- split -d -n $NF $ARCHIVO
- echo "[-] File divided into " $NF "parts\e[0m"
- elif [ $SPLIT == 2 ];then
- echo -e "\e[1;36m[-] Enter the size of divided parts\e[0m"
- read SF
- split -b $SF $ARCHIVO
- fi
- elif [ $OPCION == 6 ];then
- echo "[-] Removing duplicates..."
- sort $ARCHIVO | uniq > cleancombo.txt
- fi
- if [ $LINEA == 'Y' ];then
- echo "[-] Removing leftover lines..."
- sed -i '/^\s*$/d' cleancombo.txt
- fi
- if [ $ESPAC == 'Y' ];then
- echo "[-] Removing leftover spaces..."
- sed -i 's/ //g' cleancombo.txt
- fi
- echo ""
- echo -e "\e[1;36m----------------------- Output ------------------------\e[0m"
- echo ""
- echo ""
- echo "Debugging..."
- if [ $OPCION == 1 ] || [ $OPCION == 3 ] || [ $OPCION == 5 ] || [ $OPCION == 6 ];then
- #cp cleancombo.txt $ARCHIVO
- echo "test"
- fi
- echo ""
- echo -e "\e[1;36m-------------------------------------------------------"
- echo "----------------- It's already clean! -----------------"
- echo "-------------------------------------------------------"
- echo "--------------------- ASSCLEANER ----------------------"
- echo -e "-------------------------------------------------------\e[0m"
- echo ""
- # notify-send "WORK FINISH"
- elif [ $INICIO == 2 ];then
- echo ""
- echo -e "\e[0;36m\e[1m------------------------------------- HELP -----------------------------------"
- echo ""
- echo -e "[1] Replace:\e[0m enter a string to be replaced by another string."
- echo ""
- echo -e "\e[0;36m\e[1m[2] Filter:\e[0m delete all lines execpt those contaning specified string."
- echo ""
- echo -e "\e[0;36m\e[1m[3] Delete to:\e[0m delete the content of all lines until specified string is reached."
- echo ""
- echo -e "\e[0;36m\e[1m[4] Count lines:\e[0m hope you understand, bro."
- echo ""
- echo -e "\e[0;36m\e[1m[5] Split up:\e[0m split the file by size or by number of files."
- echo ""
- echo -e "\e[0;36m\e[1m[6] Remove duplicates:\e[0m really does need explanation?"
- echo ""
- echo -e "\e[0;36m\e[1m-------------------------------------------------------------------------------\e[0m"
- else
- echo ""
- echo -e "\e[0;36m\e[1mBye bro.\e[0m"
- echo ""
- fi
- done
- #ASSCLEANER By BISHA
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement