Article 52A53 [SOLVED] Perl: Multiline Not Working Though Using Single Line Mode

[SOLVED] Perl: Multiline Not Working Though Using Single Line Mode

by
blueray
from LinuxQuestions.org on (#52A53)
The following code works:

Code:$ echo "Name:James Herriot Bladibla James Herriot:9" | perl -ne '/Name:(\w*\s\w*).*\1:(\d)/ and print $2'But when I insert newline in the input, it does not work anymore (I tried using single line mode when using \n).

The following code does not work:

Code:$ printf "Name:James Herriot\nBladibla\nJames Herriot:9" | perl -ne '/Name:(\w*\s\w*).*\1:(\d)/s and print $2'What might be the issue here?latest?d=yIl2AUoC8zA latest?i=fCdEfRtUhOE:gjSoFtHDzh0:F7zBnMy latest?i=fCdEfRtUhOE:gjSoFtHDzh0:V_sGLiP latest?d=qj6IDK7rITs latest?i=fCdEfRtUhOE:gjSoFtHDzh0:gIN9vFwfCdEfRtUhOE
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments