aboutsummaryrefslogtreecommitdiff
path: root/challenge-002/paulo-custodio/awk/ch-1.awk
blob: 1db88fd0eb6f261a7d2490b026d2645ce9ba81b8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#!/usr/bin/gawk

# Challenge 002
#
# Challenge #1
# Write a script or one-liner to remove leading zeros from positive numbers.

BEGIN {
    num = ARGV[1];
    if (match(num, /^0*([0-9]+)/, capture))
        print capture[1];
    else
        print num;
    exit 0;
}