Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

sorting large text file

Status
Not open for further replies.

hr

Technical User
Nov 11, 2000
29
CH
Hi folks!

I have to sort the following input file (the first field should be the key):

Mister RossStreet 11200 City; cash amount 100; xyz
Madame BrownStreet 91000Town; cash amount 9; xyz
Mister RossStreet 11200 City; cash amount 13; xyz
Madame BrownStreet 91000Town; cash amount 9; xyz

After sorting it should look like this:

Madame BrownStreet 91000Town; cash amount 9; xyz
Madame BrownStreet 91000Town; cash amount 9; xyz
Mister RossStreet 11200 City; cash amount 100; xyz
Mister RossStreet 11200 City; cash amount 13; xyz

; is used as delimiter

final file size would be about 100 MByte

Thanks a lot in advance
 
If you are on a UNIX box,

sort -t \; -k 1,1 filename >new_file_name

-t \; identifies ';' as the delimiter
-k 1,1 says sort on the first field
>new_file_name says send the results into a new file named new_file_name

HTH


keep the rudder amid ship and beware the odd typo
 
hi again,
I have to work on a windows box, so your hint probably don't work, I don't know
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top