I have a file that i want to pars using grep command, the file consist of lines like this:
NVO,0,267,61,247357,247357,O,19:00:00.000000,06:09:08.417320,07:55:22.068670
DVD,0,267,61,247357,247357,O,19:00:00.000000,06:09:08.417320,07:55:22.068670
NVO,0,267,61,247358,247358,B,19:00:00.000000,06:09:08.417407,07:55:22.079291
DVD,0,267,61,247358,247358,B,19:00:00.000000,06:09:08.417407,07:55:22.079291
I want to get only the line that start with NVO, and have ,B, in the line. the out put should look like this:
NVO,0,267,61,247358,247358,B,19:00:00.000000,06:09:08.417407,07:55:22.079291
to get the NVO, line I'm using grep ^NVO, file_name.txt but I'm unable to add the second condition ,B,
I tried grep '^NVO,|,B,' file_name.txt and also
grep ",B," | grep "^NVO," file_name.txt
with no luck
I know I can do it with two commands, the first to write to file and then to do a second grep command with the ,B, filter