mardi 7 juillet 2020

Get the lines that end with 6 digits perl [duplicate]

#!usr/bin/perl

if ($var =~ m/(\d+)$/) {
    print $var;
}

$var has the list of strings as
abscd123456
hfkjsdhfkj_nsj126789
ionf12

I need to print lines that have more than 2 digits at the end of line. In this example the first two lines. Please provide the if statement (\d{3,}$) does not work.

Aucun commentaire:

Enregistrer un commentaire