Created
January 12, 2017 18:02
-
-
Save edmondscommerce/87472f274e47ed90a2dafa2cdf48a75f to your computer and use it in GitHub Desktop.
Get Column Numbers for CSV file in Bash
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
| # This will take a CSV file as input, | |
| # pull out the header row, | |
| # split that onto new lines | |
| # and then prepend a zero indexed line number to each line | |
| head ./filename.csv -n 1 | sed "s/,/\n/g" | awk '{printf("%d %s\n", NR-1, $0)}' | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment