Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 7175 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

If it's got tabs and ; to separate each field, just use a text editor to globally remove the ; wherever it appears (find and replace). Save as a new file, then import this new file as a tab-separated type.

Posted

On the Mac, the fields are spaces, not tabs. you should download either BBEdit or TextWrangler from Bare Bones Software, Inc., if you don't already use one of them. their URL is:

http://www.barebones.com/

Once you have one of them, you can do Grep Search and replaces that will speed up the find and replace that you would have to do with this file otherwise.

Let me know if and when you have it, and I can help you with a Grep pattern to fix the Text file for you needs.

The neat thing about the Grep Patterns, is that they can be kept for future use.

HTH

Lee cool.gif

Posted

To add to what Lee says (and it is a very simple grep for this), you can build (or record) a simple AppleScript to automate this, if you have to do it often.

But Jaguar is kind of old. TextWrangler (free): Requires Mac OS X 10.3.5 or later. BBEdit Lite (free also) would run on your machine. It has grep, but it does not have AppleScript support. And it is no longer supported or on their web site.

There are other free tools, such as the Satimage Scripting Addition, which has had grep for a long time. But now we're getting Mac-geeky :-)

There's also the $15 shareware Tex-Edit Plus, http://www.tex-edit.com, which now has grep (with examples and documentation). It is not as powerful as the BBEdit family, but it will run on Jaguar I imagine. It is also highly AppleScriptable.

Posted

Or, if you really want to harness the power of BSD, you could do this with sed from a shell prompt.

sed '/foo/bar/g' will substitute 'bar' for every occurence of 'foo' in a file.

Posted

Gentlemen: not to belittle your valuable advice, but...

In order to replace all occurences of ";" with the tab charcters, it is not necessary to use grep, Applescript or the terminal. Or to download a text editor.

All it takes is open the file in TextEdit, type a tab at the end of the text, select the tab and cut it (Command-X). Then select Find (Command-F), type ";" (without the quotes) into the Find cell, and paste the tab into the Replace cell. Click Replace All, save the file with a .tab extension and you're done.

Posted

Thanks everyone for their imput!!

I got BBEdit and upgraded to 10.3.8 os.

My new problem is how to actually do the find and replace there are occurances of:

" ;"

" ;"

" ;"

etc

So what I am doing is finding each occurace that is unique of the space and ; pattern and replacing it with ",". I am then renaming the extension to make it into a csv file. Once I did this and went to look at the file it had some problems. Am I missing something or is this the way to do it?

Lee you stated you may be interested in helping me with the pattern, I would love some help. The sample attached file contains the an example of most of the multiple patterns.

Thanks again everyone.

Posted

Piece of cake.

Just do a find and replace. Find ; and replace with nothing. LOL

Actually, the file you posted has some variables to the ; patterns. If the field separator is the ; then do a find for the semicolon ; and replace with 3 zeros, If not, let me know what is.

After you have ran the above find and replace, you will then have lots of zeros between your fields, so

Check the box "Grep" in the find window and type or post this or copy and paste it in the

Find

( +)

and this as a replace

t

HTH

Lee

cool.gif

Posted

I forgot to say that you need to click the box that says start at the top, in the find box as well.

Lee

This topic is 7175 days old. Please don't post here. Open a new topic instead.

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
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.