Wednesday, July 15, 2009

Search and Replace in bash

#!/bin/bash
origvar="This is the original string";
replvar=${origvar//original/changed};
replvar=${replvar//string/result.};
echo "replvar==\"${replvar}\".";
echo "this should now state \"This is the changed result.\".";

No comments: