Created
June 16, 2020 00:53
-
-
Save binshengliu/98187763c118c9a86dee8a06d0dd4142 to your computer and use it in GitHub Desktop.
Prepend line number and a tab to each line
This file contains 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
# Number each line | |
cat FILE | sed -r 's/^[[:space:]]*//' | awk '{print NR, "\t", $0}' | |
# Remove empty lines and number | |
cat FILE | sed -r 's/^[[:space:]]*//' | grep -v '^$' | awk '{print NR, "\t", $0}' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment