Last active
April 13, 2017 08:57
-
-
Save eungjun-yi/d223181fa6e43b0c372137fa34d317e6 to your computer and use it in GitHub Desktop.
Correct numbers of list
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
number=1 | |
while read line | |
do | |
echo $line | grep -E '^[0-9][0-9]*' > /dev/null | |
if [ "$?" = "0" ]; then | |
echo $line | sed "s/^[0-9][0-9]*\./$number\./" | |
number=`echo $number+1|bc` | |
else | |
echo $line | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
example: