nix, shell, perl, php, mysql and mac os x tips and tricks

Thursday, July 9, 2009

escape potential spaces and parentheses in output

ls -rt1 /Users/user/Documents/*.doc | tail -1 | sed 's/ /\\ /g' | sed 's/(/\\(/g' | sed 's/)/\\)/g'

No comments:

Post a Comment