I have a file called test.txt with the following:
> Last login: Mon Jul 13 05:09:33 2020 You have mail.
> ******************************
> cat, you ha
You may want to say:
perl -ne 'print $& if /.+@.+\K:/' test.txt
which outputs:
:
print if CONDITION is equivalent to print $_ if CONDITION and just prints the line without modifications if the CONDITION meets.
Please use $& instead.cat@sampleserver2: will cause an error saying
"Can't open cat@sampleserver2:: No such file or directory."