Suppose I have a foo.txt file with the following content:
[2010-11-13 12:00:02,656]
[2010-11-13 12:00:02,701]
[2010-11-13 12:00:02,902]
When I ack
for the date portion with the following, it works:
ack "(?P<foo>\d{4}-\d{2}-\d{2})" foo.txt --output "\$1"
2010-11-13
2010-11-13
2010-11-13
But when I try to use --output
with the named group "foo", I cannot get it to work:
ack "(?P<foo>\d{4}-\d{2}-\d{2})" foo.txt --output "(?P=foo)"
(?=foo)
(?=foo)
(?=foo)
Any help is greatly appreciate it. Thanks so much.