UMLS Community
Date: May 26, 2011
User contribution: RRF2TAB
Authors: Dr. Daniel Hinostroza, Julian Maya
Purpose: changes | to <tab> using Terminal.  Useful for importing large files 
(such as MRCONSO.RRF) into FileMaker. Works with Snow Leopard.

How to:
1. Open OS X Terminal (bash)

2. Open Utilities/Activity Monitor.  You'll need this to know when the script 
has finished replacing.  Select Terminal (Process name), then choose Disk 
Activity.

3. Replace the relevant portions of this line, then copy and paste the line 
into the Terminal window:
sed 's/\character_to_be_changed/new_character/g' < full_path_to_your_file.RRF 
> full_path_to_your_file.TAB
The easy way to get the full_path_to_your_file.RRF part is to write:
sed 's/\|/<tab>/g' < 
and then drag the RRF file to where the cursor is blinking in the Terminal 
window.  Then write
>
and then drag the same RRF file to where the cursor is blinking in the 
Terminal window.  Replace the RRF extension with TAB

For this example, the "character_to_be_changed" is the pipe (|).  The 
new_character is the tab (	), achieved in the terminal by holding down 
'ctrl' and pressing 'v' and then 'i'.  This should output tab-delimited 
fields in any RRF file.
Example:
sed 's/\|/  /g' < /Users/MyAccount/Desktop/umls2011aa/2011AA/META/MRCONSO.RRF  
> /Users/MyAccount/Desktop/umls2011aa/2011AA/META/MRCONSO.TAB

4. While the machine is happily replacing, you should see Disk Activity shoot 
upwards (Data read, Data written).  When it stops, you can safely go to the 
next step.  On my machine it takes less than a minute to process a large 
MRCONSO file.

6. Now you should have your new .TAB file next to the original RRF file, 
leaving the RRF untouched.

7. Finally, if you wish to import this file into FileMaker, since the RRF 
files doe not include a "first row contains Field names", you also need to do 
that manually.  For MRCONSO, copy and paste the following line into Smultron 
or Fraise.
CUI	LAT	TS	LUI	STT	SUI	ISPREF	AUI	SAUI	SCUI	SDUI	SAB
	TTY	CODE	STR	SRL	SUPPRESS	CVF
Save the file with a .tab extension (I used UTF-8) and throw it into the 
FileMaker icon on the Dock.  At the prompt, select "Field names" and click 
Continue.  You'll be prompted to save the file.
Now you're ready to import your large .tab file into the FileMaker file you 
just created using "last order" and UTF-8 as Character Set.  FileMaker 
adjusts the field sizes and types automatically.  Filemaker also indexes 
automatically during searches although you can change this behavior in the 
field options from "Automatically create indexes as needed" to "All".

Let me know if a video tutorial would be of help!
Dr. med. Daniel Hinostroza
dhinostroza@gmail.com
umlscommunity@cerebroperiferico.com