Using awk to cut the last characters of a string

In the example the string is “10987654321” and you want the 5 last characters of a string so “54321”:

Dans l’exemple la chaîne est “10987654321” et on veut les 5 deniers caractères donc “54321” :

#> echo "10987654321" |awk '{print substr($0, length($0)-4)}'
54321

Leave Comment

Your email address will not be published. Required fields are marked *