I have a file called test.txt with the following:
> Last login: Mon Jul 13 05:09:33 2020 You have mail.
> ******************************
> cat, you have just logged into machine sampleserver2
> ******************************
>
> --------------------------------------------------------------
> | To switch environments later, run: |
> | |
> | change |
> | |
> --------------------------------------------------------------
>
>
> Current Dir => /apps/users/cat Oracle SID: SAMPLE
> cat@sampleserver2:
I try running the command below to only return the last colon but it returns the full line. To my understanding it should only be returning the : and not cat@sampleserver2:. What am I doing wrong? I'm also using a version of Perl that should be able to handle this.
cat test.txt | perl -ne 'print if /.+@.+\K:/'
cat@sampleserver2:
% perl -v
This is perl 5, version 30, subversion 1 (v5.30.1) built for
x86_64-linux-ld