Commit | Line | Data |
---|---|---|
1 | #!/bin/bash | |
2 | ||
3 | remove_leading_zeroes() { | |
4 | # Desc: Removes leading zeroes from lines | |
5 | # Input: stdin | |
6 | # Output: stdout | |
7 | # Depends: BK-2020-03 read_stdin() | |
8 | # Version: 0.0.2 | |
9 | while read -r line; do | |
10 | printf "%s\n" "$line" | sed -E -e 's/(^0*)([0-9].*)/\2/'; | |
11 | done; | |
12 | }; | |
13 | ||
14 | printf "00000.jpg\n0001.jpg\n2.jpg\n000003.jpg\n0010.jpg\n"; | |
15 | printf "========================\n"; | |
16 | printf "00000.jpg\n0001.jpg\n2.jpg\n000003.jpg\n0010.jpg\n" | remove_leading_zeroes; | |
17 |