[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: How to direct output into the LibreOffice Calc



On Wed, Feb 29, 2012 at 10:47 PM, Christopher Judd <judd@wadsworth.org> wrote:
> On Wednesday 29 February 2012 08:40:12 lina wrote:
>
>> On Wed, Feb 29, 2012 at 7:16 PM, Darac Marjal <mailinglist@darac.org.uk>
>> wrote:
>
>> > On Tue, Feb 28, 2012 at 10:06:48PM +0800, lina wrote:
>
>> >> Hi,
>
>> >>
>
>> >> I wonder:
>
>> >>
>
>> >> 1]
>
>> >>
>
>> >> can the output like:
>
>> >>
>
>> >> 5
>
>> >> 3
>
>> >> 1
>
>> >> 5
>
>> >> 3
>
>> >>
>
>> >> direct it into the LibreOffice directly. without copy and paste.
>
>> >
>
>> > Directly, no. However, LibreOffice has an extensive API[1]. In theory,
>
>> > you could create a script (there is a python example) that accepts
>
>> > input, starts LibreOffice and then pastes the lines into cells (I'm
>
>>
>
>
> Actually (Ijust figured out), you can do something like:
>
>
> somescript >tempfile ; localc --calc -o tempfile ; rm tempfile

Thanks, a bit impressed by the localc --calc

If someone has interest, really welcome "refine" below commands

just tried to calculate the occurance. of those numbers,

(I don't have much CS background except 11 years ago took one course,
seems fundamental knowledge of computer and one semester of C
language. I finished that C without writing a serious program. sorry I
am a bit interested how people think in solving problems, just please
feel free to comment.)

$ more pathway_data.txt | sed 's/[^0-9 ]//g' | tr " " "\n" | sed
'/^$/d' | sort | uniq -c  | sed -re 's/^ +//g' | sort -n -r > tempfile
; localc --calc -o tempfile ; rm tempfile

$ head pathway_data.txt
[['5', '4', '5'], ['19', '5', '4', '5']]
[['47', '46', '47']]
[['76', '46', '76'], ['76', '34', '76', '34'], ['62', '60', '62', '60', '46']]
[]
[['76', '46', '76'], ['46', '48', '46', '34']]
[['46', '44', '46']]
[['19', '39', '19'], ['19', '5', '4', '5']]
[]

Since thanks for all the help and suggestions,

Best regards,
>
>
> without learning to use the API.
>
>
> -Chris
>
>
>
>> Thanks, the python example is far more "complicate" than I could
>
>> simply copy from terminal, open the Excel and paste.
>
>>
>
>> > assuming you want the numbers in a spreadsheet). If you have ever
>
>> > programmed Excel, LibreOffice shouldn't present much of a learning
>
>>
>
>> I don't have much experience in programming in Excel, only know some
>
>> very basic functions.
>
>>
>
>> > curve.
>
>> >
>
>> > [1] http://api.libreoffice.org/
>
>>
>
>> Thanks again for your time,
>
>>
>
>> Best regards,
>
>>
>
>> > --
>
>> > Darac Marjal
>
>> >
>
>> >
>
>> > --
>
>> > To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
>
>> > with a subject of "unsubscribe". Trouble? Contact
>
>> > listmaster@lists.debian.org Archive:
>
>> > [🔎] 20120229111615.GB8039@darac.org.uk">http://lists.debian.org/[🔎] 20120229111615.GB8039@darac.org.uk
>
>
> ------------------------------------------------------------------------
>
> | Christopher Judd, Ph. D. |
>
> | Research Scientist III |
>
> | NYS Dept. of Health judd@wadsworth.org |
>
> | Wadsworth Center - ESP |
>
> | P. O. Box 509 518 486-7829 |
>
> | Albany, NY 12201-0509 |
>
> ------------------------------------------------------------------------
>
>
>
>
> IMPORTANT NOTICE: This e-mail and any attachments may contain
> confidential or sensitive information which is, or may be, legally
> privileged or otherwise protected by law from further disclosure. It
> is intended only for the addressee. If you received this in error or
> from someone who was not authorized to send it to you, please do not
> distribute, copy or use it or any attachments. Please notify the
> sender immediately by reply e-mail and delete this from your
> system. Thank you for your cooperation.


Reply to: