LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 08-10-2011, 03:52 PM   #1
aceinthehole
LQ Newbie
 
Registered: Aug 2011
Posts: 2

Rep: Reputation: Disabled
Question CLI tool to convert Crystal Report RTF to CSV


Hi all,

I have in my possession an RTF exported from Crystal Reports.

I need to convert it into a CSV so it can be used inside of Excel or other spreadsheets applications.

Here is a snippet of the document:

Code:
{\pard \pvpg\phpg\posx12960\posy1207\absw840\absh-600\fi0 \ltrpar\qc\tx360\tx720{\ltrch\f0 \b\i0\ul0\strike0\fs15 \cf1 Date \par}\fi0 \ltrpar\qc\tx360\tx720{\ltrch\f0 \b\i0\ul0\strike0\fs15 \cf1 of Last }{\ltrch\f0 \b\i0\ul0\strike0\fs15 \cf1 Inspection\par}}
As you can see, the RTF does not have a table format. Rather, each field is made up of a floating text element that has been absolutely positioned within the document. The actual name of this column is "Date of Last Inspection."

Does anyone have a suggestion on how to convert this from the Crystal Report RTF using a CLI tool? I have about 60 such documents to batch process.

TIA!
- Ace
 
Old 08-11-2011, 11:20 AM   #2
David the H.
Bash Guru
 
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Arch + Xfce
Posts: 6,852

Rep: Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037
I have no idea about the exact formats that your application outputs, but if possible you should see if it has any way to directly output to csv or a similar format.

Otherwise, you can try to first run it through unrtf or a similar application that can convert rtf to other formats.

Basically, if you can get the files into a format that's more easily parseable by standard shell tools like awk, then it should be possible to build a csv file from them.
 
Old 08-11-2011, 11:51 AM   #3
aceinthehole
LQ Newbie
 
Registered: Aug 2011
Posts: 2

Original Poster
Rep: Reputation: Disabled
Thanks

Thanks David, perfect advice.

I need to do some reading on awk, and I never knew about the unrtf program.

Here is what looks like the document header:

Code:
{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fswiss\fcharset0 Arial;}}{\colortbl;\red0\green0\blue0;}{\info{\title NY State Bridge Data}{\author Crystal Reports}{\doccomm Powered By Crystal}{\company Crystal Decisions}}{\*\userprops {\propname Business Objects Context Information}\proptype30{\staticval 016F3B86677DF327C4BB27C93C1CAA9450D4A81B7E48339734AD384EB47F3CF101AE035D5C93B1516C449BCF1F8004D9E07E065AD4DBF821C26217444152A3B14F10F4B31FCBF771DECADC1E5B5DD8047400078CC35F51544BA76CE79C17798531AE4FC2B9E2C8DADB691A231DC33F6BE8FC62C835F77D4BE9390EBCE7B4C06}{\propname Business Objects Context Information1}\proptype30{\staticval F826530EC439CA3899E0A89F83AB0124E8FDFE6A967DF09AD5744302DF5279D94C3004667D069BC1BF7E06149F93AD85841B799DE2B5E68C8F8EE80C45AD673167AA9861617E50391D698089214440F4F564C9D0CB264E6EC0620698E0DC6AE41180F43B5BA8B765D68A1511AE6D3ABAC701D3F4073B20AD7D80B07865BA4D7}{\propname Business Objects Context Information2}\proptype30{\staticval 11F5E2E40EBF55F5E3F74F51BFEEA4DCB6190EB04D72F0921C04C87B61F70C48582A914047475C2109B7E2A9C3834FE6C654B10D4C8FBC32FF111CBEF3AAD087C245815CE700059E0A5E21C5F3F865998341367ED02D0B3A0AA0B22CB78AF279E15B8602FCDB49A0A3212DDA9776E0814CB6C91338A324A75508B8492A87F6E}{\propname Business Objects Context Information3}\proptype30{\staticval F04C77358E61221CD9397569830B356E4E2EE}}
\landscape\paperw15840\paperh12240\margl360\margr360\margt360\margb360\gutter0\windowctrl\ftnbj\viewkind1\viewscale100\sectd\linex0\sbknone
The unfortunate part is that I can't get access to the original Crystal Reports system to get a decent export.

Last edited by aceinthehole; 08-11-2011 at 11:52 AM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Convert RTF to PDF hypernetics Linux - Software 6 04-04-2014 04:46 AM
CLI RTF text editor? linus72 Linux - General 4 08-23-2013 12:40 AM
[SOLVED] Batch Convert Linux Text Format to RTF? Super TWiT Linux - Software 4 08-27-2010 01:37 PM
crystal report development vivekguna Linux - Enterprise 0 08-29-2007 12:29 AM
Looking for a RTF to PDF conversion tool buggabill Linux - Software 3 05-09-2007 09:06 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 05:35 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration