I’m working with command-line SVN. Coming from TortoiseSVN on Windows, I found it very tedious whenever I try to pick one specific file to revert, diff, commit, etc., when the path is very long like this:
src/com/company/stuff/platform/appname/subpackage/subsubpackage/Foo.java
If I want to do a diff on this file, I have to type all this:
svn diff src/com/company/stuff/platform/appname/subpackage/subsubpackage/Foo.java
so, I try to grep that by doing this:
svn st | grep Foo
But it returns:
M src/com/company/stuff/platform/appname/subpackage/subsubpackage/Foo.java
Now, how do I strip off the “M ” part, so I can get just the file path?
For this I’d use
awk:awktakes scripts with matching instructions and blocks of code to execute on the lines that match. This matches lines withFooin them and prints the second field. (Using the defaultFSfield-separator, which should split on tabs and spaces.)You should also look into the filename completion abilities of your shell; most newer shells include the ability to complete partially-typed filenames. For your long example:
I’d probably type it like this:
You might need to type more or less depending upon what files are in your directories.