Jump to content

Text replacement question.


Justin90

Recommended Posts

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.

Link to comment
Share on other sites


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.

Link to comment
Share on other sites

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?

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

Popular among WHOM? :unsure:

I mean like :whistle: :

  1. Pogrammers
  2. Web developers
  3. Kids
  4. Electricians and Plumbers
  5. Other

jaclaz

Edited by jaclaz
Link to comment
Share on other sites

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.

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

Popular among WHOM? :unsure:

I mean like :whistle: :

  1. Pogrammers
  2. Web developers
  3. Kids
  4. Electricians and Plumbers
  5. Other

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

Edited by Justin90
Link to comment
Share on other sites

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?

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

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.

Link to comment
Share on other sites

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.

Edited by Justin90
Link to comment
Share on other sites

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:

$option = Get-Content .\option.xml

To output to screen:

$option.select.option

To output to file:

$option.select.option | out-file .\options.txt

Link to comment
Share on other sites

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:

6199>Patriot 250

6200>Patriot 250 MX

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

Patriot 250

Patriot 250 MX

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

jaclaz

Link to comment
Share on other sites

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

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...