in reply to Re: extract file name from pathin thread extract file name from path
I posted it without being able to test. Now I am back home and can test, and it works for me as shown in this session under the Perl debugger:
DB<1> $line = 'root 30145 1 0 Jan30 ? 00:09:01 /root/java/app/java_a
DB<2> $id = $1 if $line =~ /(\w+)\.java\s/;
DB<3> print $id;
And, BTW, I don 't see why I received a downvote for a solution that works.
Bought a souvenir
Emailed all my friends about it
Got blowed up
Hit him right dead in the jaw
Made it awkward
Took a selfie
Want to go home
Results (316 votes). Check out past polls.