GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   Is there a script to automatically sort out a list alphabetically (https://gfy.com/showthread.php?t=843484)

Clean_Franck 07-24-2008 11:55 AM

Is there a script to automatically sort out a list alphabetically
 
here is the format my links are in:
http://www.freeporn.com/iehwih - Free Porn for you
http://www.freeporn.com/8uy98 - A best porn
http://www.freeporn.com/qwq23 - Zach porn
Is there a way to sort them alphabetically from the beginning of the descriptions, not the link?

CF

Trixxxia 07-24-2008 11:56 AM

mmm Excel?

Put the link in one column, the description in another
highlight the entire page and click Data Sort by Column B

ADL Colin 07-24-2008 11:57 AM

http://www.freeporn.com/8uy98 - A best porn
http://www.freeporn.com/iehwih - Free Porn for you
http://www.freeporn.com/qwq23 - Zach porn

glad I could help

Linguist 07-24-2008 12:31 PM

in shell: swap links with descriptions, sort alphabetically, swap back
in php/python/etc: make an array of pairs, sort by description
in sql: insert into table, select and order by description

excel works too
edit: to do it in excel you'll wanna mass replace "-" with "," before opening the file

AnniKN 07-24-2008 12:33 PM

If you have the links in a list exactly the way you posted (as in, not really in two columns) paste in a text file, and do a replace of " - " for a tab, and then paste it in Excel like Trixxxia said, after sorting, copy again, paste again and replace TAB for " - "

tranza 07-24-2008 12:37 PM

Quote:

Originally Posted by Trixxxia (Post 14501005)
mmm Excel?

Put the link in one column, the description in another
highlight the entire page and click Data Sort by Column B



What she said.

fallenmuffin 07-24-2008 12:45 PM

Quick PHP solution I wrote for you.

Code:

<?php

/**
 * Link Sort
 *
 * @author  Fallen Muffin Media <[email protected]>
 */

$filePath = 'links.txt';

$links = file($filePath);

foreach($links as $link) {
  $linkFrag = explode(' - ', $link);
  $descArray[] = array($linkFrag[1], $linkFrag[0]);
}

sort($descArray);

for ($i=0;$i<count($descArray);$i++) {
  echo '<a href='.$descArray[$i][1].'>'.$descArray[$i][0].'</a><br />';
}

?>


Antonio 07-24-2008 01:00 PM

Quote:

Originally Posted by AnniKN (Post 14501257)
If you have the links in a list exactly the way you posted (as in, not really in two columns) paste in a text file, and do a replace of " - " for a tab, and then paste it in Excel like Trixxxia said, after sorting, copy again, paste again and replace TAB for " - "

that's what I do all the time (importing fhgs with descriptions and thumbs) but I use Access, it feels so much easier but that's probably besause I'm not too familiar with Excel, I've tried it a few times but it looks pretty awkward

Trixxxia 07-24-2008 01:54 PM

Quote:

Originally Posted by Antonio (Post 14501480)
that's what I do all the time (importing fhgs with descriptions and thumbs) but I use Access, it feels so much easier but that's probably besause I'm not too familiar with Excel, I've tried it a few times but it looks pretty awkward

**oops forgot the put in the replace part :)

Everyone tells me Access is easier, but for the life of me, I'm lost with it so Excel is my friend.


All times are GMT -7. The time now is 10:56 AM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc