# remove text on first line: sed -i s/label:v\(.5\)// Dec15IR2e_y/* # remove empty first line: sed -i '/^$/d' Dec15IR2e_y/* # replace file length number with numRows numCols: # looks only on line 1; finds any number of numbers next to each other; substitue pastes this back, followed by 2 sed -i '1s/^[0-9]*/& 2/' Dec15IR2e_y/* # previously used these: sed -i s/15291/15291\ 2/ Dec15IR2e_y/* sed -i -e s/4200/4200\ 2/ Dec15IR2e_y/* ?????