MSFN Forum: Text replacement question. - MSFN Forum

Jump to content


  • 2 Pages +
  • 1
  • 2
  • You cannot start a new topic
  • You cannot reply to this topic

Text replacement question. Rate Topic: -----

#1 User is offline   Justin90 

  • Newbie
  • Group: Members
  • Posts: 15
  • Joined: 14-November 11
  • OS:Windows 7 x64
  • Country: Country Flag

Posted 14 November 2011 - 11:48 AM

I have a question with replacing text in the Alleycode program.

Here are some of the lines I'm working with:
2524>Ranger 700 6x6 EFI Commercial
7890>Ranger 700 Crew
7891>Ranger 700 Crew LE Black Cherry
7892>Ranger 700 Crew LE Browning Hunter Edition
7893>Ranger 700 Crew LE Turbo Silver
2525>Ranger 700 HD

I'm looking for a way to replace the start of each line (e.g. 2524>, 7890>, 7891>) up to the > with blank space so I only end up with the model of these four wheelers (there's many more, that's why I'm trying to figure out an easy way to do this).

Is there a way to automatically do this by using a code in the replace feature, or another way I can do it?

I'm at work and could really use a quick response on this... I need to get these done ASAP.
Thanks.


#2 User is offline   Tripredacus 

  • K-Mart-ian Legend
  • Group: Super Moderator
  • Posts: 8,665
  • Joined: 28-April 06
  • OS:Server 2012
  • Country: Country Flag

Posted 14 November 2011 - 12:09 PM

Do not make multiple topics for the same thing. :realmad:

What is Alleycode? Is it an online HTML editor?

#3 User is offline   Justin90 

  • Newbie
  • Group: Members
  • Posts: 15
  • Joined: 14-November 11
  • OS:Windows 7 x64
  • Country: Country Flag

Posted 14 November 2011 - 03:31 PM

yea its used for several things. you should check it out. but i just need to know if there's some code that i can use to make it faster.

#4 User is offline   Tripredacus 

  • K-Mart-ian Legend
  • Group: Super Moderator
  • Posts: 8,665
  • Joined: 28-April 06
  • OS:Server 2012
  • Country: Country Flag

Posted 15 November 2011 - 09:21 AM

I have not used that program and don't intend on trying it. I do all my web work using SciTE and UltraEdit.

Did you try using their support option? I saw on their main site they had a link for it.

#5 User is offline   Justin90 

  • Newbie
  • Group: Members
  • Posts: 15
  • Joined: 14-November 11
  • OS:Windows 7 x64
  • Country: Country Flag

Posted 15 November 2011 - 01:45 PM

Yes, I tried it and they said they don't know of a way to do it using the replace feature... do you know of another program that can do what I'm asking?

By the way Alleycode is pretty popular, I'm surprised you haven't heard of it.

#6 User is offline   jaclaz 

  • The Finder
  • Group: Developers
  • Posts: 11,420
  • Joined: 23-July 04
  • OS:none specified
  • Country: Country Flag

Posted 15 November 2011 - 02:00 PM

View PostJustin90, on 15 November 2011 - 01:45 PM, said:

Yes, I tried it and they said they don't know of a way to do it using the replace feature... do you know of another program that can do what I'm asking?

Are we talking of replacing some text in a .htm or .html file?

View PostJustin90, on 15 November 2011 - 01:45 PM, said:

By the way Alleycode is pretty popular, I'm surprised you haven't heard of it.

Popular among WHOM? :unsure:

I mean like :whistle: :
  • Pogrammers
  • Web developers
  • Kids
  • Electricians and Plumbers
  • Other



jaclaz

This post has been edited by jaclaz: 15 November 2011 - 02:02 PM


#7 User is offline   Justin90 

  • Newbie
  • Group: Members
  • Posts: 15
  • Joined: 14-November 11
  • OS:Windows 7 x64
  • Country: Country Flag

Posted 15 November 2011 - 02:16 PM

View Postjaclaz, on 15 November 2011 - 02:00 PM, said:

Yes, I tried it and they said they don't know of a way to do it using the replace feature... do you know of another program that can do what I'm asking?
Are we talking of replacing some text in a .htm or .html file?

The format doesn't really matter. If you know a code to replace a start of a line to a like symbol (> would be the symbol in this case) then give me the code and I can use it.

Quote

By the way Alleycode is pretty popular, I'm surprised you haven't heard of it.

Popular among WHOM? :unsure:

I mean like :whistle: :
  • Pogrammers
  • Web developers
  • Kids
  • Electricians and Plumbers
  • Other


Programmers, web developers. My boss uses alleycode every day and created a $7,000+ a day website with it.

This post has been edited by Justin90: 15 November 2011 - 02:19 PM


#8 User is offline   jaclaz 

  • The Finder
  • Group: Developers
  • Posts: 11,420
  • Joined: 23-July 04
  • OS:none specified
  • Country: Country Flag

Posted 15 November 2011 - 02:26 PM

View PostJustin90, on 15 November 2011 - 02:16 PM, said:

The format doesn't really matter. If you know a code to replace a start of a line to a like symbol (> would be the symbol in this case) then give me the code and I can use it.

It does, rest assured, is the file a TEXT format or a binary one?


View PostJustin90, on 15 November 2011 - 01:45 PM, said:

Programmers, web developers. My boss uses alleycode every day and created a $7,000+ a day website with it.

Well, the fact that your boss made a site with alleycode and that this particuar site makes a 7K bucks a day ( i.e. roughly 2.5 millions US$ per year) are two facts, but not necessarily in a cause-effect relationship.

It should mean that your boss is highly creative and knows very well how to build and promote sites, not necesarily that alleycode is popular among programmers (or at least let's say that I know very few programmers making 2.5 million bucks per year, so it is possible that alleycode is popular among only among this -I presume -restricted group of people, let's call them RICH programmers).
But a programmer would probably know how to replace a few characters in the beginning of each line in a file. :unsure:

jaclaz

#9 User is offline   Tripredacus 

  • K-Mart-ian Legend
  • Group: Super Moderator
  • Posts: 8,665
  • Joined: 28-April 06
  • OS:Server 2012
  • Country: Country Flag

Posted 15 November 2011 - 03:03 PM

View Postjaclaz, on 15 November 2011 - 02:26 PM, said:

View PostJustin90, on 15 November 2011 - 02:16 PM, said:

The format doesn't really matter. If you know a code to replace a start of a line to a like symbol (> would be the symbol in this case) then give me the code and I can use it.

It does, rest assured, is the file a TEXT format or a binary one?


As noted, the format is extremely important, especially when dealing with a markup language that uses the same characters you want to replace. We could say a standard "search and destroy" formula such as this would seem ideal:

FIND "*>" REPLACE ""

However, you'd see that HTML uses > in it's markup tags, so using a replace like that would destroy the page. However, another option would be to programmatically do a find/replace where you can look for the specific things you want. If this data were kept in a database, a trim would work fine, but if it is in the text of HTML you'd need to specify something like:

FIND "xxxx>" WHERE (x = numerical value) with ""

Of course your standard find and replace isn't smart enough to do this, so a custom app or script would be required. Then again, the amount of time developing and testing said script until it is done may actually take longer than just changing all those values by hand.

#10 User is offline   CoffeeFiend 

  • Coffee Aficionado
  • Group: Super Moderator
  • Posts: 5,399
  • Joined: 14-July 04
  • OS:Windows 7 x64
  • Country: Country Flag

Posted 15 November 2011 - 04:05 PM

View Postjaclaz, on 15 November 2011 - 02:26 PM, said:

Well, the fact that your boss made a site with alleycode and that this particuar site makes a 7K bucks a day ( i.e. roughly 2.5 millions US$ per year) are two facts, but not necessarily in a cause-effect relationship.

^^ What he said. You could make a multi-million dollar site using notepad or any old text editor. That means very little about the text editor, it's more about running a business than anything else. Also, I wouldn't call Alleycode "well known" at all, even in the web development world (and "not at all" as for "traditional" programmers). The big player is obviously Dreamweaver, followed by dozens of small yet somewhat popular apps, including many text editors (notepad++, notepad2, textmate, ultraedit, pspad, gedit, emacs, vim, nano, etc) and several HTML editors (Expression Web, FrontPage before that, Nvu, etc). I've never heard of Alleycode before, and I will be surprised if I ever hear about again.

View Postjaclaz, on 15 November 2011 - 02:26 PM, said:

But a programmer would probably know how to replace a few characters in the beginning of each line in a file. :unsure:

That kind of task (search and replace strings, with very simple text I/O) is well within reach of scripting newbies, let alone decent programmers. Either ways, it sounds like he can afford to hire someone to do it.

#11 User is offline   Justin90 

  • Newbie
  • Group: Members
  • Posts: 15
  • Joined: 14-November 11
  • OS:Windows 7 x64
  • Country: Country Flag

Posted 16 November 2011 - 11:29 AM

Ok if the format matters I guess...

Here's why I'm doing this, actually haven't had much time to work on it, only gotten a couple hundred done out of the thousands I have to get. I'm really busy most of the time lol.

______________________________
I'm taking models that look like this -

<option value="6199">Patriot 250</option>
<option value="6200">Patriot 250 MX</option>

I then use replace to remove <option value=", the extra ", and the </option>

Leaving me with:
6199>Patriot 250
6200>Patriot 250

These are models of four wheelers. I will be grabbing thousands of these to be plugging in to a model finder on my bosses websites. It will be entered in as HTML once I get them all done.

So all I need to do I guess is find some code to replace starting at the beginning of the line up to the >.
If using HTML to have the numbers replaced up to the > causes a problem, I can simply change that symbol to anything using the replace feature, so if you know of a code I can use, tell me to change > to whatever it needs to be to get it to work.

Thanks for trying to help and communicate so far guys.

And as for my boss being able to write the code, he's too busy for that, that's why I came to this forum seeking people who like to write code as projects and just mess with code in general to see if I could be helped to get this to go faster.
He's doing a complete overhaul on all of our websites at the moment and is working from home so everyone doesn't bother him about little stuff (this would be classified as more little stuff to him).

Edit: I'm not really sure about the format actually... when I'm done with these I'm saving them as CSV (comma separated values) sheets. I think he just has to go in to the master database and upload them. So no it doesn't really matter what format I change it in.
The object is just to end up with the model number and get it saved to a CSV sheet for uploading, how I get the numbers off doesn't matter at all.

This post has been edited by Justin90: 16 November 2011 - 11:37 AM


#12 User is offline   IcemanND 

  • MSFN Junkie
  • Group: Super Moderator
  • Posts: 3,266
  • Joined: 24-September 03
  • OS:Windows 7 x64
  • Country: Country Flag

Posted 16 November 2011 - 11:50 AM

How about going about this in a totally different way? Looks like you are pulling this info from a web page. Copy everything from the <select to </select> an save it in a file. Import the file as XML using power shell and then read the attributes out to a new file.

So if you save something like the following as option.xml:
<Select name="vehicle">
  <option value="6199">Patriot 250</option>
  <option value="6200">Patriot 250 MX</option>
</select>


Then in powershell type the following commands, from the directory the option.xml file is in:
[xml]$option = Get-Content .\option.xml

To output to screen:
$option.select.option

To output to file:
$option.select.option | out-file .\options.txt

#13 User is offline   jaclaz 

  • The Finder
  • Group: Developers
  • Posts: 11,420
  • Joined: 23-July 04
  • OS:none specified
  • Country: Country Flag

Posted 16 November 2011 - 12:06 PM

It took all of 37 seconds to devise this mindboggingly complex :w00t: batch script (actually a one-liner :whistle: ):
@ECHO OFF&FOR /F "tokens=2 delims=^>" %%A IN (testmodel.csv) do echo %%A>>mymodels.csv


If you have "testmodel.csv" containing:

Quote

6199>Patriot 250
6200>Patriot 250 MX


You will get as result a mymodels.csv file containing:

Quote

Patriot 250
Patriot 250 MX


Consequently, since I normally invoice a mere 3,600 US$/hour, you owe me 37 US$. :angel

jaclaz

#14 User is offline   IcemanND 

  • MSFN Junkie
  • Group: Super Moderator
  • Posts: 3,266
  • Joined: 24-September 03
  • OS:Windows 7 x64
  • Country: Country Flag

Posted 16 November 2011 - 01:00 PM

View Postjaclaz, on 16 November 2011 - 12:06 PM, said:

Consequently, since I normally invoice a mere 3,600 US$/hour, you owe me 37 US$. :angel

jaclaz


Remind me not to have you fix one of my computers.

#15 User is offline   jaclaz 

  • The Finder
  • Group: Developers
  • Posts: 11,420
  • Joined: 23-July 04
  • OS:none specified
  • Country: Country Flag

Posted 16 November 2011 - 01:09 PM

View PostIcemanND, on 16 November 2011 - 01:00 PM, said:

Remind me not to have you fix one of my computers.

Well, I make SUBSTANTIAL rebates on my list prices for old-time friends like you ;) and BTW, the mentioned rate was the one reserved to RICH programmers/web developers only.
I calculate through a complex algorithm (which I won't fully disclose) that basically takes into account the inverse of the sum of the squares of the Alexa Ranking of the sites owned by the client. :whistle:

jaclaz

#16 User is offline   Justin90 

  • Newbie
  • Group: Members
  • Posts: 15
  • Joined: 14-November 11
  • OS:Windows 7 x64
  • Country: Country Flag

Posted 16 November 2011 - 02:38 PM

View Postjaclaz, on 16 November 2011 - 12:06 PM, said:

It took all of 37 seconds to devise this mindboggingly complex :w00t: batch script (actually a one-liner :whistle: ):
@ECHO OFF&FOR /F "tokens=2 delims=^>" %%A IN (testmodel.csv) do echo %%A>>mymodels.csv



Where would I be using this code at jaclaz?
I don't really know where to use it like what program, what part of the program... I'm pretty new to this.
I appreciate your time even though you all are poking fun at me lol.

It's okay I'm a newbie I get it

Edit:

Removed image lol, don't want to keep that on here =o

I tried to save some of the models as testmodels.csv in a text document, and then tried to run the code in cmd prompt (im clueless, just guessing where to use it) and i got "##A was unexpected at this time."

Dang I felt so close to finding the answer, but no more responses...

Thanks for the help if I've exhausted your knowledge on the subject. I appreciate it.

This post has been edited by Justin90: 17 November 2011 - 09:57 AM


#17 User is offline   jaclaz 

  • The Finder
  • Group: Developers
  • Posts: 11,420
  • Joined: 23-July 04
  • OS:none specified
  • Country: Country Flag

Posted 17 November 2011 - 04:45 AM

View PostJustin90, on 16 November 2011 - 02:38 PM, said:

I tried to save some of the models as testmodels.csv in a text document, and then tried to run the code in cmd prompt (im clueless, just guessing where to use it) and i got "##A was unexpected at this time."


Yes :), the snippet I posted should be copied and pasted in a .cmd file.
If you want to run it in a command line (from a command prompt in the same directory where testmodels.csv is) you need to use single percentage signs, as in the following:
Command line:
@ECHO OFF&FOR /F "tokens=2 delims=^>" %A IN (testmodel.csv) do echo %A>>mymodels.csv

Inside a .cmd file:
@ECHO OFF&FOR /F "tokens=2 delims=^>" %%A IN (testmodel.csv) do echo %%A>>mymodels.csv


View PostJustin90, on 16 November 2011 - 02:38 PM, said:

Here's proof I wasn't lying by the way lol...

I don't get it :unsure:, noone said you were lying, I said that you mistakenly attributed the success of an enterprise to the tool (specifically Alleycode) it was supposedly used to build the site.
In any case what you posted is an UNreadable screenshot of heavens only know WHAT (beacuse it is unreadable).
IF I had doubted your word about your boss making around 2.5 Millions bucks a year, you would hae needed to send me an authenticated copy of his IRS tax form ;) to prove your statement.


jaclaz

#18 User is offline   Tripredacus 

  • K-Mart-ian Legend
  • Group: Super Moderator
  • Posts: 8,665
  • Joined: 28-April 06
  • OS:Server 2012
  • Country: Country Flag

Posted 17 November 2011 - 09:23 AM

View Postjaclaz, on 17 November 2011 - 04:45 AM, said:

In any case what you posted is an UNreadable screenshot of heavens only know WHAT (beacuse it is unreadable).

jaclaz


At a thumbnail size in such low quality, its a wonder why editing out names was even necessary. Except that it can be seen it is MerchantPlus NaviGate. Unfortunately, it is impossible to independently verify the findings using that site since likely both of these cases need to be true:
1. Have an account on that site
2. Have that account on that site
I had indeed found that particular site but alas have no account to log in with. This may be related to the obscure fact that my own website makes absolutely NO money and actually costs me to keep it going. ;)

#19 User is offline   jaclaz 

  • The Finder
  • Group: Developers
  • Posts: 11,420
  • Joined: 23-July 04
  • OS:none specified
  • Country: Country Flag

Posted 17 November 2011 - 09:35 AM

View PostTripredacus, on 17 November 2011 - 09:23 AM, said:

This may be related to the obscure fact that my own website makes absolutely NO money and actually costs me to keep it going. ;)

Nothing actually obscure, it is obvious: you are simply NOT using Alleycode! ;)

:lol:

jaclaz

#20 User is offline   Kelsenellenelvian 

  • WPI Guru
  • Group: Developers
  • Posts: 8,322
  • Joined: 18-September 03
  • OS:Windows 7 x64
  • Country: Country Flag

Posted 17 November 2011 - 09:41 AM

I am swithcing to alleycode in the hope I can make way more than the @2 bucks a day I do!!!

Share this topic:


  • 2 Pages +
  • 1
  • 2
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users



All trademarks mentioned on this page are the property of their respective owners
Copyright © 2001 - 2013 msfn.org
Privacy Policy