I have a .csv file with contents similar to this:
BIHAR,PURNIA,DAGARUA,BELGACHHI,BELGACHHI,KARBOLA TOLA,0,0,312,0,0,312,Fully Covered,NO,NO,01_04_2010,241656,312,2123,910,1811.5
BIHAR,PURNIA,SRINAGAR,THARI,THARI,ARBANNA,0,0,312,0,0,312,Fully Covered,NO,NO,01_04_2010,244374,312,2123,910,1811.5
BIHAR,PURNIA,RUPAULI,DHOBGIDHA-RUPAULI,DHOBHGIDHA-RUPAULI-II,MATELI,0,0,312,0,0,312,Fully Covered,NO,NO,01_04_2010,243748,312,2123,910,1811.5
ETCETC,PURNIA,KRITYANAND NAGAR,CHUNAPUR,BANBHAG,BANGALI TOLA KOSHI KINARA,0,0,312,0,0,312,Fully Covered,NO,NO,01_04_2010,242663,312,2123,910,1811.5
I want to grab all the lines that start with BIHAR
and then output it to another separate csv file. How do I do that?
I have tried using sublime's "Find All" feature and then use the right arrow to the end of the line to highlight them, but unfortunately some lines are much longer than the others so it doesn't work. There are about 100'000 lines in the .txt file.
I also tried with sed:
sed -n 'BIHAR /myfile.txt' /newfile.txt
EDIT: For some reason grep/sed/awk ignores the newlines at the end of each line, and so as a result it only attempts to match the first line and nothing else, how do I fix this?