(mostly) oneliners

awk

count lines

awk '{ ln++ } END { print ln }' file; }

print last separated item

awk -F'.' '{print $NF}'

ed

Insert second to line 3 of first

$ cat first
one
two
three
four
five
six
seven
eight

$ cat second
blah
blah
blah

$ echo '3 -r second
> w
> q
> ' | ed -s first

$ cat first
one
two
blah
blah
blah
three
four
five
six
seven
eight

find

find with full path

find ~+ -type d -maxdepth 1

Sort files by size

find . -type f -exec ls -alh {} \; | sort -hr -k5

grep

match 1-100

grep -E '^(100|[1-9][0-9]?|[1-9])$')

perl

reverse_line_order() { perl -e 'print reverse <>'; }
count_lines() { perl -lne 'END { print $. }'; }

sed

remove_html() { sed -e 's/<[^>]*>//g' ;}
reverse_file() { sed -n '1!G;$p;h'; }
print_lines_from_to() { sed -n '5,10p' ;}
remove_last_line() { sed '$d' ;}
remove_leading_and_trailing_whitespace() { sed -e 's/^ [ \t]*//g' -e 's/[ \t]*$//g'; }
insert_space_between_characters() { sed 's/./& /g' ;}

misc

unicode2ascii() { iconv -f utf-8 -t us-ascii//translit//ignore | sed "s/\'//g"; }