Rundown: sed

Remove long lines from bash history

1sed -i -r '/([^ ]{100,})\s?$/d' $HISTFILE

Convert a csv file to markdown

1column -o '|' -ts, "$1" + | sed -r '0,/./p ; 0,/./s/[a-zA-Z ]/-/g; 0,/^|/s/\|-/|:/g'

Change a CSV header

1from=number
2to=quantity
3sed -i "1 s///" "".csv

Replace first instance of word

1sed '0,/${word}/s//${replacement}/' ${file}

Combine many recfiles of different types into one

1sed '1i\ ' *.rec > all.rec

Combine many recfiles of the same type into one

1recinf -d -t ${type} ${one}.rec > ${all}.rec
2sed '/^%/d' ${one}.rec ${two}.rec > all.rec

The strange syntax used by sed only makes sense after using ed

Remove non-printable characters

1sed -i 's/[^[:print:]]//g' ${file}