Showing posts with label scripting. Show all posts
Showing posts with label scripting. Show all posts

Thursday, August 27, 2009

How to stop unix read command escape backslashes

If you want to pipe any output that has backslashes in it (or make 'read' take a string with backslashes) to the read command then you will need to stop the read command treating backslash as escape character by using read -r
e.g.
cleartool ls | while read -r file
do
# do something to file
done

Friday, January 9, 2009

How to do mass renaming of file extension

Problem:
You want to rename all the .wiki files to be .textile instead.

Solution:
\ls -1 *.wiki | while read f; do mv $f ${f%.wiki}.textile; done