tests: Use shell and sed instead of foreach