1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

How to remove numbers, which are there before an URL ?

Discussion in 'BlackHat Lounge' started by lonojoe, Mar 10, 2011.

  1. lonojoe

    lonojoe Junior Member

    Joined:
    Nov 8, 2009
    Messages:
    168
    Likes Received:
    95
  2. luiza

    luiza Junior Member

    Joined:
    Oct 10, 2009
    Messages:
    132
    Likes Received:
    308
    copy and paste the list into excel. then use formulas to strip out the number.

    1. find length of text string
    2. find "http" starting position
    3. use RIGHT forumula length -start position + 1

    so if "http" begins at character 4, and length is 29, the formula will copy only the characters of the url.

    then do a copy and paste special values and you have just the urls without the numbers.
     
    • Thanks Thanks x 1
  3. jond1

    jond1 Junior Member

    Joined:
    Apr 26, 2010
    Messages:
    132
    Likes Received:
    10
    just google "text crawler" and download it. It's a free software that will allow you to do what you want.
     
    • Thanks Thanks x 1
  4. lonojoe

    lonojoe Junior Member

    Joined:
    Nov 8, 2009
    Messages:
    168
    Likes Received:
    95
    Thanks for the reply man, but string length varies in each line. Will that work that time also?
     
  5. rocket

    rocket Regular Member

    Joined:
    Apr 14, 2009
    Messages:
    471
    Likes Received:
    131
    Occupation:
    Web developer and marketer
    Location:
    In my competitor's mind
    Notepad++ does this easily
     
    • Thanks Thanks x 1
  6. GrizzlyAdams

    GrizzlyAdams Regular Member

    Joined:
    Feb 17, 2011
    Messages:
    479
    Likes Received:
    405
    Occupation:
    Freelancer
    Location:
    British Columbia
    do you have dreamweaver? easy to do it with dreamweaver. let me know if you do and i'll explain.
     
    • Thanks Thanks x 1
  7. Jayemdae

    Jayemdae Newbie

    Joined:
    Feb 15, 2010
    Messages:
    46
    Likes Received:
    36
    Occupation:
    Techie
    Location:
    Indianapolis, IN
    lonojoe, yes...it will work even though the length changes.

    If you have all the values in column A, then put this formula in B1 and copy/paste it so that it's in as many rows of column B as you have rows in column A.

    Code:
    =RIGHT(A1,LEN(A1)-FIND("http",A1)+1)
    As luiza said, then you'll copy column B, go to column C and use "Paste Special", "Values". You'll then have exactly what you need in column C. Delete columns A & B and save the file as a text file and you're set.

    There are so many ways this can be done (inlcuding Notepad++), but this will get it done with Excel (or probably even Google Docs/Spreadsheet).

    Cheers!
     
    • Thanks Thanks x 1
  8. Autumn

    Autumn Elite Member

    Joined:
    Nov 18, 2010
    Messages:
    2,197
    Likes Received:
    3,046
    Occupation:
    I figure out ways to make money online and then au
    Location:
    Spamville
    Save this script as remove_prefix.php and upload it to one of your domains on your hosting. It gives you a simple text box you can copy and paste your urls into, and will strip anything before the http:// part of each url.

    PHP:
    <?php

    /*************************************************************************\
    remove_prefix.php

    Removes cruft from the beginning of a list of urls.

    By Autumn @ BHW

    Created:  Thu Mar 10 18:09:56 NZDT 2011
    \*************************************************************************/

    if($_POST['posted'] == 'yes') {
        
    $lines $_POST['lines'];
        
    $lines explode("\n"$lines);
        foreach(
    $lines as $line) {
            
    $line preg_replace("/.*http/i"'http'$line);
            echo 
    "$line<br>\n";
        }

        echo 
    "<br><br><a href=\""$_SERVER['PHP_SELF'] ."\">Strip another list</a>";


    } else {

        echo 
    "<html>
    <head>
    <title>Remove url prefixes</title>
    </head>
    <body>
    Enter your urls to strip:<br>
    <form method=\"post\" action=\""
    $_SERVER['PHP_SELF'] ."\">
    <input type=\"hidden\" name=\"posted\" value=\"yes\">
    <textarea rows=\"40\" cols=\"100\" name=\"lines\">
    </textarea><br>
    <input type=\"submit\" value=\"Strip\">
    </form>
    </body>
    </html>
    "
    ;

    }

    ?>
     
    • Thanks Thanks x 1
  9. lonojoe

    lonojoe Junior Member

    Joined:
    Nov 8, 2009
    Messages:
    168
    Likes Received:
    95
    Thanks Everyone.

    I used Notepad++. Suggested by rocket

    Nice piece of software. It took no more than some seconds. :D

    Autumn
    Jayemdae
    jond1
    luiza


    for the suggestions.

    Got it done by using Notepad++. Thanks man.
     
    Last edited: Mar 10, 2011