Make your shell prompt useful:
PS1="-----------------------------------------------------------------------\n\u@\W:"
Make your shell prompt useful:
PS1="-----------------------------------------------------------------------\n\u@\W:"
Check for spelling errors in the Constitution of the United States of America
spell cotus.txt | sort | uniq
Mirror a website on your hard drive:
Copy all the html files from your local mirror of a website to a single directory:
find . -name "*.html" -exec cp {} /home/teresita/Desktop/html \;
Convert all the html files in a directory to text:
for i in *.html; do lynx --dump "$i" > "${i%%.*}.txt";done
Rot13 “cipher” in #Python
#!/usr/bin/python3
import sys, string
def rot13(s):
return ''.join([chr(x.islower() and ((ord(x) - 84) % 26) + 97
or x.isupper() and ((ord(x) - 52) % 26) + 65
or ord(x))
for x in s])
for line in sys.stdin:
sys.stdout.write(rot13(line))
Add line numbers to a file (Four digits, leading zeros, separated by a colon):
nl -i1 -s': ' -nrz -w4 cotus.txt
awk '{printf"%04d: ",NR;print}' cotus.txt
Oh wait, you don’t want to count the blank lines?
awk '/[^ ]/{printf"%04d: ",++n}{print}' cotus.txt
Oh wait, you only want the first 30 lines?
awk '/[^ ]/{printf"%04d: ",++n}{print}NR==30{exit}' cotus.txt