find svn uncommitted files and list their properties

svn status | awk -F" " '{ for (i=2; i<=NF; i++) print "ls -ld \""$i"\""}' | sh
The AWK part of the code will "collate" the fields from 2nd to Nth field (this is to handle any svn directories that may have spaces in them - typical when working with code that is interchangeably used with windows environment - for example, documentation teams) - the output is passed to "ls -ld" - the -d option to ls will tell ls to handle directories itself, rather than do ls on the directory. The '-p' option is just for pretty printing directories, links and executables (for added readability). Finally, the entire "constructed" command will be passed onto sh for shell execution.
Sample Output
> svn status | awk -F" " '{ for (i=2; i<=NF; i++) print "ls -ldp \""$i"\""}' | sh
-rw-r--r--   1 buildadmin     users        27606 Feb  4 00:34 Makefile
-rw-r--r--   1 buildadmin     users        16514 Feb  3 23:38 cpp/test/Makefile
drwxr-xr-x   2 buildadmin     users         4096 Feb  3 23:38 cpp/test/policytest/Linux2.6_PPC64/
-rw-r--r--   1 buildadmin     users        18712 Feb  3 23:38 cpp/test/policytest/Makefile
drwxr-xr-x   2 buildadmin     users         4096 Feb  3 23:38 cpp/test/myprodpartest/Linux2.6_PPC64/
-rw-r--r--   1 buildadmin     users        18681 Feb  3 23:38 cpp/test/myprodpartest/Makefile
drwxr-xr-x   3 buildadmin     users         4096 Feb  3 23:38 cpp/i18n/myprod/en/
-rw-r--r--   1 buildadmin     users        17269 Feb  3 23:38 cpp/i18n/myprod/Makefile
drwxr-xr-x   2 buildadmin     users         4096 Feb  3 23:36 cpp/i18n/myprod/C/Linux2.6_PPC64/
-rw-r--r--   1 buildadmin     users        16598 Feb  3 23:37 cpp/samples/Makefile
drwxr-xr-x   2 buildadmin     users         4096 Feb  3 23:38 cpp/samples/tools/MyProd/Linux2.6_PPC64/
-rw-r--r--   1 buildadmin     users        18731 Feb  3 23:37 cpp/samples/tools/MyProd/Makefile
drwxr-xr-x   2 buildadmin     users         4096 Feb  3 23:38 cpp/samples/myprodagent/Linux2.6_PPC64/
-rw-r--r--   1 buildadmin     users        18718 Feb  3 23:38 cpp/samples/myprodagent/Makefile
-rw-r--r--   1 buildadmin     users        22869 Feb  3 23:35 cpp/src/MyProd/Makefile
drwxr-xr-x   2 buildadmin     users        16384 Feb  3 23:37 cpp/src/MyProd/Linux2.6_PPC64/

0
By: kln0thing
2014-07-09 09:41:24

1 Alternatives + Submit Alt

  • Find all files in SVN workspace directories which are uncommitted. List them and find their properties Show Sample Output


    0
    for d in `ls -d *`; do svn status $d | awk '{print $2}'; done | xargs ls -l {} \;
    dronamk · 2014-05-27 19:07:45 1

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands



Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: