emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] refile whole files as headings?


From: Matt Price
Subject: Re: [O] refile whole files as headings?
Date: Tue, 1 Sep 2015 21:18:32 -0400

Thank you so much Nick!

I am terrible with sed and with pipes, and ended up having two problems when trying to use this code with sed; I ended up modifying it to the following:

for f in *.org; do
    echo "* $f" >> allofem.org
    # cat $f
    cat $f | sed 's/^\*/**/' >> allofem.org
done

not as elegant looking as yours, but it worked for me.

very helpful and much appreciated!
m


On Tue, Sep 1, 2015 at 4:03 PM, Nick Dokos <address@hidden> wrote:
Matt Price <address@hidden> writes:

> I am reorganizing my courses, consolidating many short files into longer ones. So, for instance, I have
> a directory like:
>
> ✗ ls Assignments
>
> ClassProjectGuidelines.org
> course-blog.org
> essay-assignment.org
> ProjectProposal.org
> STA-01-CSS.org
> STA-02-wordpress-themes.org
> STA-03-Foundation.org
> STA-04-maps.org
>
> I'd like to turn this into Assignments.org, with a structure like this:
>
> * ClassProjectGuidelines.org
> * course-blog.org
> * essay-assignment.org
> * ProjectProposal.org
> * STA-01-CSS.org
> * STA-02-wordpress-themes.org
> * STA-03-Foundation.org
> * STA-04-maps.org
>
> It's sort of the reverse of Marcin's one-to-many export issue as described in another thread.  Best ways
> to accomplish this? thx,
> m

A shell script:

--8<---------------cut here---------------start------------->8---
cd Assignments
for f in *.org; do
  echo "* $f"
  cat $f
done > Assignments.org
--8<---------------cut here---------------end--------------->8---

If you need to change the levels of the headings in the files,
use a sed script instead of cat:

   sed '/^\*/s/&/**/' $f

Nick




reply via email to

[Prev in Thread] Current Thread [Next in Thread]