Tags

, , ,

A one-liner to substitute extension “.txt” with “.tex”  for a set of files in the Bourne-Again shell (bash):

$ for i in *; do mv "$i" "${i%%txt}tex"; done

The quotes take care of the spaces in the filenames. The tricky part is the {i%%txt}tex — which I find very userful.

Advertisements