How do i extract lines from a text file which satisfy this regex ^2.
I am using linux.
I know grep is able to extract the number of lines but i would need them to be output to a text file.
Is it possible to use grep or other solutions are better? The text file is about 20gb
grep "^2"
filename
?grep ^2 filename > result.txt
?