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.5BIHAR,PURNIA,SRINAGAR,THARI,THARI,ARBANNA,0,0,312,0,0,312,Fully Covered,NO,NO,01_04_2010,244374,312,2123,910,1811.5BIHAR,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.5ETCETC,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.5I 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.txtEDIT: 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?
Extract all lines from a file starting with some sequence and then output it to another file
grep
Try this with GNU sed:sed -n '/^BIHAR/p' file > new_fileor with grep:grep '^BIHAR' file > new_fileor with awk:awk '/^BIHAR/' file > new_file