[Lazarus] help with grep search string
Marc Santhoff
M.Santhoff at web.de
Tue Jun 30 15:14:33 CEST 2009
Am Dienstag, den 30.06.2009, 14:38 +0200 schrieb Graeme Geldenhuys:
> Hi,
>
> I want to try and improve the IDE to detect SVN or Git repositories, and still extract the correct latest revision number. I have the following output which is part of the commit message generated by Git, when it syncs with a SubVersion repository.
>
> I'm trying to write a grep command that will extract the revision number only.
> eg:
> 16557
> 16556
> 16555
> ...
>
> Can anybody help me please? I wrote the following which asks git to only output commit messages containing "git-svn-id", then I run that through standard grep extracting only the line containing the search string. It's this latter part that I want to fix to only return the revision number.
>
> Any help would be greatly appreciated.
>
>
> $ git log --grep="git-svn-id:" | grep git-svn-id
>
> ============ Sample output ===================
> git-svn-id: http://svn2.freepascal.org/svn/lazarus/trunk@16557 4005530d-fff6-0310-9dd1-cebe43e6787f
> git-svn-id: http://svn2.freepascal.org/svn/lazarus/trunk@16556 4005530d-fff6-0310-9dd1-cebe43e6787f
> git-svn-id: http://svn2.freepascal.org/svn/lazarus/trunk@16555 4005530d-fff6-0310-9dd1-cebe43e6787f
> git-svn-id: http://svn2.freepascal.org/svn/lazarus/trunk@16554 4005530d-fff6-0310-9dd1-cebe43e6787f
> git-svn-id: http://svn2.freepascal.org/svn/lazarus/trunk@16553 4005530d-fff6-0310-9dd1-cebe43e6787f
> git-svn-id: http://svn2.freepascal.org/svn/lazarus/trunk@16552 4005530d-fff6-0310-9dd1-cebe43e6787f
>
> =======================================
try:
| awk -F@ '{split($2, x, " "); print x[1]}'
HTH,
--
Marc Santhoff <M.Santhoff at web.de>
More information about the Lazarus
mailing list