* Insert filename
@ 2016-06-19 9:59 Phil Cuddy
[not found] ` <9a6af4c5-82ff-4de6-b7a5-64bc742c586c-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
0 siblings, 1 reply; 6+ messages in thread
From: Phil Cuddy @ 2016-06-19 9:59 UTC (permalink / raw)
To: pandoc-discuss
[-- Attachment #1: Type: text/plain, Size: 242 bytes --]
Hi all, I am trying to export markdown formatted text files and I insert the Filename as the header of each file. Here is the code I am using to do the export, how do I insert the filename?
pandoc test.txt -f markdown -t rtf -s -o test1.rtf
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Insert filename
[not found] ` <9a6af4c5-82ff-4de6-b7a5-64bc742c586c-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
@ 2016-06-20 18:07 ` John MacFarlane
[not found] ` <20160620180721.GB94282-jF64zX8BO091tJRe0FUodcM6rOWSkUom@public.gmane.org>
0 siblings, 1 reply; 6+ messages in thread
From: John MacFarlane @ 2016-06-20 18:07 UTC (permalink / raw)
To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw
There's no built-in way to do this. You can create a custom
template with a $filename$ variable, then set this variable
on the command line with
-V filename=test.txt
+++ Phil Cuddy [Jun 19 16 02:59 ]:
>Hi all, I am trying to export markdown formatted text files and I insert the Filename as the header of each file. Here is the code I am using to do the export, how do I insert the filename?
>
>pandoc test.txt -f markdown -t rtf -s -o test1.rtf
>
>--
>You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
>To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
>To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
>To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/9a6af4c5-82ff-4de6-b7a5-64bc742c586c%40googlegroups.com.
>For more options, visit https://groups.google.com/d/optout.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Insert filename
[not found] ` <20160620180721.GB94282-jF64zX8BO091tJRe0FUodcM6rOWSkUom@public.gmane.org>
@ 2016-06-21 16:26 ` Phil Cuddy
[not found] ` <fc3ce04e-222d-42fc-ab89-ef301415dd1f-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
0 siblings, 1 reply; 6+ messages in thread
From: Phil Cuddy @ 2016-06-21 16:26 UTC (permalink / raw)
To: pandoc-discuss
[-- Attachment #1.1: Type: text/plain, Size: 1998 bytes --]
Hi, i have found the following perl script that party does what i want,
(insert the filename in each text file), but it fails if there are spaces
in the filename. Any ideas on how to amend?
perl -i -pe 'BEGIN{undef $/;} s/^/$ARGV\n/' `find . -name '*.txt'`
On Monday, 20 June 2016 19:07:19 UTC+1, John MacFarlane wrote:
>
> There's no built-in way to do this. You can create a custom
> template with a $filename$ variable, then set this variable
> on the command line with
>
> -V filename=test.txt
>
> +++ Phil Cuddy [Jun 19 16 02:59 ]:
> >Hi all, I am trying to export markdown formatted text files and I insert
> the Filename as the header of each file. Here is the code I am using to do
> the export, how do I insert the filename?
> >
> >pandoc test.txt -f markdown -t rtf -s -o test1.rtf
> >
> >--
> >You received this message because you are subscribed to the Google Groups
> "pandoc-discuss" group.
> >To unsubscribe from this group and stop receiving emails from it, send an
> email to pandoc-discus...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org <javascript:>.
> >To post to this group, send email to pandoc-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
> <javascript:>.
> >To view this discussion on the web visit
> https://groups.google.com/d/msgid/pandoc-discuss/9a6af4c5-82ff-4de6-b7a5-64bc742c586c%40googlegroups.com.
>
> >For more options, visit https://groups.google.com/d/optout.
>
>
--
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/fc3ce04e-222d-42fc-ab89-ef301415dd1f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
[-- Attachment #1.2: Type: text/html, Size: 4358 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Insert filename
[not found] ` <fc3ce04e-222d-42fc-ab89-ef301415dd1f-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
@ 2016-06-21 18:47 ` daniel
[not found] ` <cf876452e8a4e5adb1bc76aa0a5e11bb-4VJSIDGPiDYGnBxjJhY9vGItS4zQEDct@public.gmane.org>
0 siblings, 1 reply; 6+ messages in thread
From: daniel @ 2016-06-21 18:47 UTC (permalink / raw)
To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw
On 2016-06-21 12:26, Phil Cuddy wrote:
> Hi, i have found the following perl script that party does what i
> want, (insert the filename in each text file), but it fails if there
> are spaces in the filename. Any ideas on how to amend?
>
> perl -i -pe 'BEGIN{undef $/;} s/^/$ARGV\n/' `find . -name '*.txt'`
>
Try:
find . -name '*.txt' -exec perl -i -pe 'BEGIN{undef $/;} s/^/$ARGV\n/'
{} \;
This is really a combo shell/perl script. It could probably be done in
just Perl as well, but this was easy enough. ;)
Daniel T. Staal
---------------------------------------------------------------
This email copyright the author. Unless otherwise noted, you
are expressly allowed to retransmit, quote, or otherwise use
the contents for non-commercial purposes. This copyright will
expire 5 years after the author's death, or in 30 years,
whichever is longer, unless such a period is in excess of
local copyright law.
---------------------------------------------------------------
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Insert filename
[not found] ` <cf876452e8a4e5adb1bc76aa0a5e11bb-4VJSIDGPiDYGnBxjJhY9vGItS4zQEDct@public.gmane.org>
@ 2016-06-21 23:06 ` BP Jonsson
2016-07-02 20:41 ` Phil Cuddy
1 sibling, 0 replies; 6+ messages in thread
From: BP Jonsson @ 2016-06-21 23:06 UTC (permalink / raw)
To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw
Den 2016-06-21 kl. 20:47, skrev daniel:
> find . -name '*.txt' -exec perl -i -pe 'BEGIN{undef $/;}
> s/^/$ARGV\n/' {} \;
Beware of perl's -i option without a backup lest you end up with
junk, i.e. make it -i.bak
It is easy enough to do rm *.bak once you are sure you did not get
any junk.
/bpj
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Insert filename
[not found] ` <cf876452e8a4e5adb1bc76aa0a5e11bb-4VJSIDGPiDYGnBxjJhY9vGItS4zQEDct@public.gmane.org>
2016-06-21 23:06 ` BP Jonsson
@ 2016-07-02 20:41 ` Phil Cuddy
1 sibling, 0 replies; 6+ messages in thread
From: Phil Cuddy @ 2016-07-02 20:41 UTC (permalink / raw)
To: pandoc-discuss
[-- Attachment #1.1: Type: text/plain, Size: 1768 bytes --]
Thanks Daniel, how would i amend that to add a blank line below the
inserted header?
On Tuesday, 21 June 2016 19:49:21 UTC+1, daniel wrote:
>
> On 2016-06-21 12:26, Phil Cuddy wrote:
> > Hi, i have found the following perl script that party does what i
> > want, (insert the filename in each text file), but it fails if there
> > are spaces in the filename. Any ideas on how to amend?
> >
> > perl -i -pe 'BEGIN{undef $/;} s/^/$ARGV\n/' `find . -name '*.txt'`
> >
>
> Try:
>
> find . -name '*.txt' -exec perl -i -pe 'BEGIN{undef $/;} s/^/$ARGV\n/'
> {} \;
>
> This is really a combo shell/perl script. It could probably be done in
> just Perl as well, but this was easy enough. ;)
>
> Daniel T. Staal
>
> ---------------------------------------------------------------
> This email copyright the author. Unless otherwise noted, you
> are expressly allowed to retransmit, quote, or otherwise use
> the contents for non-commercial purposes. This copyright will
> expire 5 years after the author's death, or in 30 years,
> whichever is longer, unless such a period is in excess of
> local copyright law.
> ---------------------------------------------------------------
>
--
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/f19553de-1059-426a-a270-0470f897675b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
[-- Attachment #1.2: Type: text/html, Size: 2455 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2016-07-02 20:41 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-19 9:59 Insert filename Phil Cuddy
[not found] ` <9a6af4c5-82ff-4de6-b7a5-64bc742c586c-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2016-06-20 18:07 ` John MacFarlane
[not found] ` <20160620180721.GB94282-jF64zX8BO091tJRe0FUodcM6rOWSkUom@public.gmane.org>
2016-06-21 16:26 ` Phil Cuddy
[not found] ` <fc3ce04e-222d-42fc-ab89-ef301415dd1f-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2016-06-21 18:47 ` daniel
[not found] ` <cf876452e8a4e5adb1bc76aa0a5e11bb-4VJSIDGPiDYGnBxjJhY9vGItS4zQEDct@public.gmane.org>
2016-06-21 23:06 ` BP Jonsson
2016-07-02 20:41 ` Phil Cuddy
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).