#!/bin/sh for i in data/userdata/*.txt ; do sort $i > $i.sorted mv $i.sorted $i done