I need to go through some java files, and pull out the authors after every @author tag. I started out looking at awk, but awk can't remove the unneded parts, and so I came across this.
What I'm running
perl -n -e'/author (.*)/ && print $1' *.java
This prints nothing. If I do
perl -n -e'/author (.*)/ && print $_' *.java
it will (correctly) print the entire line.
I can do this, and it does accomplish my goal, but I still want to know why my capture group isn't working.
perl -n -e"/\@author / && print $'" *.java
Example input:
/* HelloWorld.java
* @author Partner of Winning
* @author Robert LastName
*/
public class HelloWorld{
public static void main(String[] args) {
System.out.println("Hello World!");
}
}