process commands from file and write back the results
print method improved