Last active
January 31, 2023 22:55
-
-
Save ashleymavericks/26c4ae0dbc2f24dfcc05a7ca7b5c7f7f to your computer and use it in GitHub Desktop.
Broad Market NSE indices
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
#!/bin/bash | |
# fetch csv using wget and write to stdout -> remove header row from the csv -> replace &/- with _ -> select only stock_symbol column -> finally redirect output to a text file | |
# using cut | |
wget -O - https://www1.nseindia.com/content/indices/ind_nifty50list.csv | sed 1d | sed 's/[&-]/_/g' | cut -d ',' -f 3 > "Broad 5 - Microcap 250".txt | |
# using awk | |
wget -O - https://www1.nseindia.com/content/indices/ind_niftymicrocap250_list.csv | sed 1d | sed 's/[&-]/_/g' | awk -F ',' '{print $3}' > "Broad 5 - Microcap 250".txt | |
wget -O - https://www1.nseindia.com/content/indices/ind_niftysmallcap250list.csv | sed 1d | sed 's/[&-]/_/g' | awk -F ',' '{print $3}' > "Broad 4 - Smallcap 250".txt | |
wget -O - https://www1.nseindia.com/content/indices/ind_niftymidcap150list.csv | sed 1d | sed 's/[&-]/_/g' | awk -F ',' '{print $3}' > "Broad 3 - Midcap 150".txt | |
wget -O - https://www1.nseindia.com/content/indices/ind_niftynext50list.csv | sed 1d | sed 's/[&-]/_/g' | awk -F ',' '{print $3}' > "Broad 2 - Nifty Next 50".txt | |
wget -O - https://www1.nseindia.com/content/indices/ind_nifty50list.csv | sed 1d | sed 's/[&-]/_/g' | awk -F ',' '{print $3}' > "Broad 1 - Nifty 50".txt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment