From mboxrd@z Thu Jan 1 00:00:00 1970 From: Matt Price Subject: Re: refile whole files as headings? Date: Tue, 1 Sep 2015 21:18:32 -0400 Message-ID: References: <87pp21q555.fsf@alphaville.usersys.redhat.com> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=047d7b10c975e9db98051eb971db Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:37569) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZWwh9-00020N-G2 for emacs-orgmode@gnu.org; Tue, 01 Sep 2015 21:18:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZWwh7-0004zD-S4 for emacs-orgmode@gnu.org; Tue, 01 Sep 2015 21:18:35 -0400 Received: from mail-ig0-x22e.google.com ([2607:f8b0:4001:c05::22e]:33750) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZWwh7-0004z7-ED for emacs-orgmode@gnu.org; Tue, 01 Sep 2015 21:18:33 -0400 Received: by igbkq10 with SMTP id kq10so14711280igb.0 for ; Tue, 01 Sep 2015 18:18:32 -0700 (PDT) In-Reply-To: <87pp21q555.fsf@alphaville.usersys.redhat.com> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Nick Dokos Cc: Org Mode --047d7b10c975e9db98051eb971db Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable 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 wrote: > Matt Price writes: > > > I am reorganizing my courses, consolidating many short files into longe= r > ones. So, for instance, I have > > a directory like: > > > > =E2=9C=97 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 > > > --047d7b10c975e9db98051eb971db Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
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
=C2=A0=C2=A0=C2=A0 echo "* $f" >= ;> allofem.org
=C2=A0=C2=A0=C2=A0 = # cat $f
=C2=A0=C2=A0=C2=A0 cat $f | sed 's/^\*/**/' >> allofem.org
done

not as el= egant looking as yours, but it worked for me.

very helpful and= much appreciated!
m


<= div class=3D"gmail_quote">On Tue, Sep 1, 2015 at 4:03 PM, Nick Dokos <ndoko= s@gmail.com> wrote:
Matt Price <moptop99@gmail.com> writes:

> I am reorganizing my courses, consolidating many short files into long= er ones. So, for instance, I have
> a directory like:
>
> =E2=9C=97 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.=C2=A0 Best ways
> to accomplish this? thx,
> m

A shell script:

--8<---------------cut here---------------start------------->8---
cd Assignments
for f in *.org; do
=C2=A0 echo "* $f"
=C2=A0 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:

=C2=A0 =C2=A0sed '/^\*/s/&/**/' $f

Nick



--047d7b10c975e9db98051eb971db--