hi,
i'm having a file stg_ff.txt
which contains 10 fields,which contains millions of records
i need to cat the first 10 rows in the file after doing a sorting on the first two fields i n the file.
can any body help me on this.
regards
Angel
hi,
i'm having a file stg_ff.txt
which contains 10 fields,which contains millions of records
i need to cat the first 10 rows in the file after doing a sorting on the first two fields i n the file.
can any body help me on this.
regards
Angel
millions of records ?
it is any table data dump from the db ? ( if yes, then you can sort it in the db itself, as you may have some index -which is faster)
sorting the millions of records takes time in unix commands
I agree with itkamaraj but still if you want to try on unix.
try this one, assuming ; is delimiter
sort -t ";" -k1,2 file_test| head -10
try this ( assuming ";" as delimiter):-
head -10 stg_ff.txt | awk -F ";" '{ print $1," ",$2}' | sort
this should suffice for the first 10 lines
head -10 stg_ff.txt | sort -k1,2