I have a novice question concerning the extraction of information from a large text file.
I want to look up a line that starts with '0010 0010', and extract the text on the same line that comes after the second double forward slash and before the end of the line, and assign this to a string.
For example, if a line contains:
0010 0010 (text) // (text) // JOHN DOE
I would like to end up with a string that has the value "JOHN DOE"
This command seems to perform the extraction correctly from the command line:
perl -lne 'print if s/0010 0010.*\/\/.*\/\///'
but I can't figure out a way of doing this from within a script, which is what I need.
I have tried various pattern matching things such as $name=~s/^(pattern)$//mgi, but nothing seems to work.
The solution is probably pretty obvious to anyone with a little experience, but I have none.
Thanks in advance
S
In reply to pattern matching by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |