Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash -e
- typeset -i DIGIT=$(sed -n $= $1)
- typeset -i digit
- if (( DIGIT < 10 )); then digit=1
- elif (( DIGIT < 100 )); then digit=2
- elif (( DIGIT < 1000 )); then digit=3
- elif (( DIGIT < 10000 )); then digit=4
- elif (( DIGIT < 100000 )); then digit=5
- else exit 9
- fi
- typeset -i line_no=1
- while read; do
- printf "%0*d %s\n" ${digit} $(( line_no++ )) "${REPLY}"
- done <$1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement