LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 03-01-2017, 08:39 AM   #16
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,770

Rep: Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210

Quote:
Originally Posted by danielbmartin View Post
However I wanted to use asorti in the belief that it is more efficient if the InFile is large. Better to manipulate indices rather than actual data. Is this correct?
If the index is a lot shorter than the data, then yes. In your latest version, the data and the index are the same, so there would be no difference. You've just made awk store all of the data twice, once in the index field and once in the data field.
Quote:
The actual source data is real estate ownership data from Wake County, North Carolina, USA. These are public records, freely downloadable by anyone. There is only one line for each street address.
Your sort looks fine when all of the addresses are on the same street and all of the house numbers have the same number of digits. Do you really want all of the addresses with number "127" on every street in the county grouped together followed by all the addresses with number 128? Do you want the numbers 1000 through 1009 to appear between number 100 and number 101?

Last edited by rknichols; 03-01-2017 at 08:40 AM.
 
1 members found this post helpful.
Old 03-01-2017, 10:32 AM   #17
danielbmartin
Senior Member
 
Registered: Apr 2010
Location: Apex, NC, USA
Distribution: Mint 17.3
Posts: 1,879

Original Poster
Rep: Reputation: 660Reputation: 660Reputation: 660Reputation: 660Reputation: 660Reputation: 660
Quote:
Originally Posted by rknichols View Post
...Do you really want all of the addresses with number "127" on every street in the county grouped together followed by all the addresses with number 128? Do you want the numbers 1000 through 1009 to appear between number 100 and number 101?
Your questions are valid but now we are getting down "into the weeds" of my application. It chooses all properties on a user-specified street and compares the Property Location Address with the Owner's Mailing Address. A match is counted as an owner-occupied residence; a no-match is counted as a rental. The input data is flawed and the logic might be questioned, but the result is fairly accurate. This is recreational programming so spot-on accuracy is not important.

All house numbers are six digits with leading zeros.

There's an esthetic appeal to accomplishing the entire job with a single awk but I now think a three-step pipe (awk-sort-awk) may be more efficient.

Thank you for your interest. Let's put this thread to rest.

Daniel B. Martin
 
  


Reply

Tags
asort, asorti, awk


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] SORT - unexpected result danielbmartin Programming 3 09-30-2015 10:18 AM
[SOLVED] Bash substring delivers unexpected result danielbmartin Programming 1 03-04-2013 09:39 AM
sox - simple command including '-r' produces different file result each time wb0gaz Linux - Software 2 08-26-2012 08:04 AM
mysql count(*) unexpected result kpachopoulos Programming 3 01-03-2008 10:08 AM
cp command problem..... unexpected result hamster Linux - General 2 04-10-2003 04:57 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 07:42 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration