cool seds

Geek, Lighting Tech, Maker

cool seds

A couple interesting sed-functions by the great Paul Flint

 
#echo "                                                      $file1 $file2"
# sed -e 's/^ *//g' | # Remove leading blank spaces
# sed -e 's/([a-zA-Z()]) ([a-zA-Z()])/1_2/g' | # Add underscres between words
# # separated by 1 blank space
# sed -e 's/ - /_-_/g' | # Swap ' - ' for '_-_'
# sed -e "s/^/$i /" | # Add filename to beginning of each file
# sed -e 's/([0-9]),([0-9])/12/g' # for numbers get rid of commas
# sed -e 's/,/ /g' # Replace commas with spaces
#
# grep -v '^ **' | # get rid of HTML menu links

Adding leading zeros…

# sed -e 's/"DC([0-9])([0-9])"/"DC01"/g' # does units like "DC10-99"

Do this twice and you are done!

No Comments

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.