$echo -en "100\n10000\n34934\n3432\n"
100
10000
34934
3432
put one less than the number of digits you want for the ending sequence:
$ echo -en "100\n10000\n34934\n3432\n" | sed -n '/^[0-9]\{1,2\}.$/p'
100
$ echo -en "100\n10000\n34934\n3432\n" | sed -n '/^[0-9]\{1,3\}.$/p'
100
3432
or if you only want 4 digits:
$ echo -en "100\n10000\n34934\n3432\n" | sed -n '/^[0-9]\{3\}.$/p'
3432
$ echo -en "100\n10000\n34934\n3432\n" | sed -n '/^[0-9]\{1,4\}.$/p'
100
10000
34934
3432
No comments:
Post a Comment