Change double-spaces to single spaces sed ‘s/ \+/ /g’ > redpine2.txt
Delete all lines in all text files of a directory which follow after the pattern “Retrieved from” find -name ‘*.txt’ -exec sed -i ‘1,/Retrieved from/!d’ {} \;
Display subdirectories in a tree format grep “:$” | sed -e ‘s/:$//’ -e ‘s/[^-][^\/]*\//—-/g’ -e ‘s/^//’ -e ‘s/-/|/’
Generate shuffled list of five-letter words with no repetitions: echo {a,i,o,u}{b,d,f,j,k,l,m,n,p,r,s,t,v,w,z}{a,i,o,u}{b,d,f,j,k,l,m,n,p,r,s,t,v,w,z}{a,i,o,u}|sed ‘s/ /\n/g’| shuf | tr ‘\n’ ‘ ‘
List all the files in a large directory on a single line: ls -1 | sed -e :a -e ‘$!N;s/\n/ \/ /;ta’
List the unique words in a file sed -e $’s/\t//g’ -e “s/[[:punct:]]\+//g” -e “s/./\L&/g” | tr ‘ ‘ \\n | sort | uniq
Prepend an asterisk to every line in a file sed -ne ‘s/.*/* &/p’ enterprise.txt > enterprise2.txt
Remove tags from HTML file sed -e :a -e ‘s/<[^<]*>/ /g;/</{N;s/\n/ /;ba;}’ CleanPosts.html

Batch convert Wordstar-encoded files to text files

for i in *; 
do strings -a -n 1 "$i" | sed -e :a -e '$!N;s/\n/ /;ta' > "${i%%.*}.txt" 

List all the files in a large directory on a single line:

ls -1 | sed -e :a -e ‘$!N;s/\n/ \/ /;ta’

Morse code

#!/bin/sed -rf
s/([A-Z])([^\n]*\n.*\1([-.]+))/\3 \2/


About Linuxgal

Need a spiritual home? Consider joining us at Mary Queen of the Universe Latter-day Buddhislamic Free Will Christian UFO Synagogue of Vishnu
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s