#!/usr/bin/env bash BASE=$1 for f in $BASE/*.ks; do perl -pe 's/\r\n|\n|\r/\n/g' $f > $f.tmp # for 2015-sssa mv $f.tmp $f done