Thursday, December 23, 2010

Extracting File Names From Full Paths Using Regex

There are tons of ways to do this, and this is pretty introductory, but I felt like posting it anyway. I wanted a quick, repeatable way to print out a list of just file names, excluding the path, from a Subversion changeset. Here it is:

Unix-style
svn status mydir | grep -o '[^\/]*$'

Windows
svn status mydir | grep -o '[^\\]*$'

No comments:

Post a Comment