I’ve a text file with 2 million lines. Each line has some transaction information.
e.g.
23848923748, sample text, feild2 , 12/12/2008
etc
What I want to do is create a new file from a certain unique transaction number onwards. So I want to split the file at the line where this number exists.
How can I do this form the command line?
I can find the line by doing this:
cat myfile.txt | grep 23423423423
On a random file in my
tmpdirectory, this is how I output everything from the line matchingpopdonwards in a file namedtmp.sh:tail -n+Xmatches from that line number onwards;grep -noutputs lineno:filename, and cut extracts justlinenofromgrep.So for your case it would be:
And it should indeed match from the first occurrence onwards.