| New Reply |
How to sort a list alphabetically but ignore numbers? |
Share Thread | Thread Tools |
| Feb27-12, 01:00 PM | #1 |
|
|
How to sort a list alphabetically but ignore numbers?
I have a list of urls I need to sort but I need to sort them only using the letters in the url?
Eg. example.com/174353/a example.com/3452344/c example.com/435322/d example.com/2342/b example.com/23456/e Would be sorted as: example.com/174353/a example.com/2342/b example.com/3452344/c example.com/435322/d example.com/23456/e Thanks AL |
| Feb27-12, 02:41 PM | #2 |
|
|
if you process the file using the / as a separator then you can extract out the 3rd field to sort on.
you could probably use awk to do the parsing to write a new file containing the key then url on one line then use the sort command to generate a sorted list. thats if you're running on linux or some unix variant. |
| Feb27-12, 03:35 PM | #3 |
|
|
Most varieties of BASIC have a Right$(,) function, which would read the closing letter(s) off the target string.
|
| Feb27-12, 03:38 PM | #4 |
|
|
How to sort a list alphabetically but ignore numbers?The addresses aren't as simple as I thought here's one for example. http:// www. flyforums. co.uk/fly-tying-step-step/160-beacon-beige.html (The spaces are just there to stop it hyperlinking it.) They all follow the same pattern with a number-couple of keywords separated by -s .html |
| Feb27-12, 04:00 PM | #5 |
|
|
|
| Feb27-12, 04:08 PM | #6 |
|
|
" File "sort.py", line 3, in <module> filename = sys.argv[1] IndexError: list index out of range" |
| Feb27-12, 04:51 PM | #7 |
|
|
Please clarify. Would the URL
http:// www. flyforums. co.uk/fly-tying-step-step/160-beacon-beige.html be lexicographically sorted with the value httpwwwflyformscoukflytryingstepstepbeaconbeigehtml ? |
| Feb27-12, 04:53 PM | #8 |
|
|
when you run it you're supposed to provide a file of your urls to be sorted.
./sorturls.py myfileofurls.lst where sorturls.py is the name of the script and the myfileofurls.lst is your file of unsorted urls. |
| New Reply |
| Thread Tools | |
Similar Threads for: How to sort a list alphabetically but ignore numbers?
|
||||
| Thread | Forum | Replies | ||
| Using the Insertion Sort algorithm on a linked list | Engineering, Comp Sci, & Technology Homework | 1 | ||
| Sort fullnames alphabetically | Programming & Comp Sci | 1 | ||
| Ignore List | Forum Feedback & Announcements | 6 | ||
| [SOLVED] ignore list | Forum Feedback & Announcements | 7 | ||