my login.txt file contains following entries
abc def abc 123 def abc abc de tha ewe
when i do the positive lookahead using perl, i\'m getting t
In your perl -ne 'print if /(?)abc\s(?!def)/' you asking perl to find abc, then space, then string shouldn't be def. This is successfully matches with def abc, because there is no def after abc here and \s matches with newline.
perl -ne 'print if /(?)abc\s(?!def)/'
abc
def
def abc
\s