Home
Shell script cheat sheet
Print the 3rd column of a CSV file
cat file.csv | cut -d ';' -f3
Count the number of columns a CSV has
head -1 file.csv | sed 's/[^;]//g' | wc -c
Run a MySQL query and save the output to a CSV file
mysql < query.sql | sed 's/\t/;/g' > out.csv
Add your own scripts directory to PATH and make it permanent in .bashrc
echo "export PATH=\$PATH:/home/crisol/bin" >> .bashrc
Scrap all the individual Tiktok URLs from the HTML element of the user page
cat html_element.txt | grep -oP 'https://www.tiktok.com/@[0-9a-zA-Z._]*/video/[0-9]*' > urls.txt
Iterate over each line of a text file
while read line; do echo "~~~~~~ $line"; my_script.sh -l "$line"; done < my_file.txt