Handling large files:
1. Suppose you have very large files and it is zipped. Now you want to track some particular line. You cannot use simply the head and tail. for example i have one files wiht 59023435 lines. Now my simulator failed and reported some problem is there in line number 23694538. How do you access this line ?
Ans : Take the help of one liner awk.
vikrant@alu.hyd /u/vikrant/data/alu/2007/04/10> zcat 20070410.gz | wc -l
59023435
vikrant@alu.hyd /u/vikrant/data/2007/04/10> zcat 20070410.gz | gawk '{if(NR >23694535 && NR < 23694540) print;}'
NOD,S1Q,20070410,113621557,113621557,50012308,BXP,128,,B,118.22,0,
NOD,S1Q,20070410,113621557,113621557,50012308,BXP,128,,B,118.16,100,
NOD,S1Q,20070410,113621557,113621557,50012308,BXP,128,,B,118.15,700, --->23694538th line
NOD,S1Q,20070410,113621557,113621557,50002349,AHO,128,,A,12.25,400,
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment