Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

In Org-mode I would like to insert the result of a Unix command in a field. For instance, consider I have the following table:

| /        |
| /bin     |
| /usr/bin |
| /lib     |
| /usr/lib |

I would like to insert a second column such as

$2 = <result of `du -sh $1` >

Is this possible?

share|improve this question

1 Answer 1

up vote 6 down vote accepted

This is an approximation to your problem:

#+TBLNAME: pepe
| /tmp      |
| /usr/info |

#+begin_src sh :var tt=pepe
du -sh $tt
#+end_src

#+RESULTS:
| 4.0K | /tmp      |
| 532K | /usr/info |
share|improve this answer
    
I copy/pasted your table snippet and pressed C-c C-c, the table isn't updated and I only get the msg `Local setup has been refreshed'. How can I execute the formula? –  rahmu Jun 26 '12 at 22:34
    
This is actual cut/paste from my test. C-c C-c should be done over the source block (not over the table). And you must have sh added to org-babel-load-languages setting. –  Juancho Jun 26 '12 at 22:50
    
It worked with Org-mode version 7.8.11, but I cannot seem to add sh to org-babel-load-languages on Org-mode 6.33x version (old version I have at work). Any chance you know how to do this on older versions? –  rahmu Jun 26 '12 at 23:07

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.