Skip to content

Instantly share code, notes, and snippets.

View p1nesap's full-sized avatar

p1nesap p1nesap

  • USA
View GitHub Profile
@p1nesap
p1nesap / bash-fun1.sh
Created December 14, 2014 00:35
Fun with operators, conditionals and exported functions.
#!/bin/bash
#Fun with operators, conditionals and exported functions. Notes below.
y=$(date +%Y)
d=$(date +%d)
m=$(date +%m)
u=`whoami`
s=`pwd`
if [ $d -lt 25 ] && [ $m == 12 ] && [[ "$s" == *"home/phoebe/shell"* ]]
then
@p1nesap
p1nesap / Bash Shell Regex Most Common Words from Web Page, Sorted to File
Last active January 6, 2016 01:06
Bash Shell Regex Most Common Words from Web Page, Sorted to File
#Process most common words from web page, and output to file, using wget, sed, awk, sort command line utilities.
Using both sed #and awk methods provides greatest accuracy. Example is for YouTube video comments.
#sed stream editor method:
wget -O - https://gdata.youtube.com/feeds/api/videos/ffVbnPjl86A/comments?orderby=published \
| sed -e 's/<[^>]*>//g' | tr -cs A-Za-z\' '\n' \ #clean up HTML tags; convert all to lowercase
| tr A-Z a-z | sort | uniq -c | sort -k1,1nr -k2 | sed ${1:-200}q > conan.txt