Print modified/added files

When working with source control systems, sometimes you need to get a list of modified/added files ignoring generated files which are not under source control. You can use this simple awk script:

awk '{ if ($1 != "?") print $2; }'

With Mercurial, the full command looks this way:

hg status | awk '{ if ($1 != "?") print $2; }'

Replace hg with svn if you use Subversion.

Of course, you can redirect the output of the commands to a file.

Advertisements

One Response to “Print modified/added files”

  1. Advanced “status” options | Programming is my life Says:

    […] weeks ago I showed how to filter output of hg status with awk. That simple awk script removes unknown (untracked) files from output and also removes the file […]


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: