ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* sed question
@ 2005-12-18 18:01 David Arnold
  2005-12-18 18:53 ` Taco Hoekwater
  2005-12-18 19:05 ` VnPenguin
  0 siblings, 2 replies; 9+ messages in thread
From: David Arnold @ 2005-12-18 18:01 UTC (permalink / raw)


All,

How would I use sed to erase %output=pdf from any file ending  
with .tex in the current directory and any subdirectories below it?

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: sed question
  2005-12-18 18:01 sed question David Arnold
@ 2005-12-18 18:53 ` Taco Hoekwater
  2005-12-18 19:07   ` David Arnold
  2005-12-18 19:05 ` VnPenguin
  1 sibling, 1 reply; 9+ messages in thread
From: Taco Hoekwater @ 2005-12-18 18:53 UTC (permalink / raw)


David Arnold wrote:
> All,
> 
> How would I use sed to erase %output=pdf from any file ending  with .tex 
> in the current directory and any subdirectories below it?

I don't know about sed, but here is a find/perl solution that would work
on linux:

   find . -name \*.tex -exec  perl -npi -e 's/%output=pdf/%/g' \{\} \;

Taco

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: sed question
  2005-12-18 18:01 sed question David Arnold
  2005-12-18 18:53 ` Taco Hoekwater
@ 2005-12-18 19:05 ` VnPenguin
  2005-12-18 19:14   ` David Arnold
  1 sibling, 1 reply; 9+ messages in thread
From: VnPenguin @ 2005-12-18 19:05 UTC (permalink / raw)


[-- Attachment #1: Type: text/plain, Size: 516 bytes --]

On 12/18/05, David Arnold <dwarnold45@cox.net> wrote:
> All,
>
> How would I use sed to erase %output=pdf from any file ending
> with .tex in the current directory and any subdirectories below it?

Delete the line containing %output=pdf:

$ find . -name "*.tex" | xargs sed -i '/%output=pdf/d'

Remove only text "output=pdf":

$ find . -name "*.tex" | xargs sed -i 's/%output=pdf/%/'

Try it with a test file before run over all your TeX files :)

HTH,

--
http://vnoss.org
Vietnamese Open Source Software Community

[-- Attachment #2: Type: text/plain, Size: 139 bytes --]

_______________________________________________
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: sed question
  2005-12-18 18:53 ` Taco Hoekwater
@ 2005-12-18 19:07   ` David Arnold
  0 siblings, 0 replies; 9+ messages in thread
From: David Arnold @ 2005-12-18 19:07 UTC (permalink / raw)


IntermediateAlgebraText $ find . -name \*.tex -exec perl -npi -e 's/% 
output=pdf/%/g' \{\}\;
find: -exec: no terminating ";"


On Dec 18, 2005, at 10:53 AM, Taco Hoekwater wrote:

> David Arnold wrote:
>> All,
>> How would I use sed to erase %output=pdf from any file ending   
>> with .tex in the current directory and any subdirectories below it?
>
> I don't know about sed, but here is a find/perl solution that would  
> work
> on linux:
>
>   find . -name \*.tex -exec  perl -npi -e 's/%output=pdf/%/g' \{\} \;
>
> Taco
>
>
> _______________________________________________
> ntg-context mailing list
> ntg-context@ntg.nl
> http://www.ntg.nl/mailman/listinfo/ntg-context

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: sed question
  2005-12-18 19:05 ` VnPenguin
@ 2005-12-18 19:14   ` David Arnold
  2005-12-18 19:26     ` Radhelorn
  0 siblings, 1 reply; 9+ messages in thread
From: David Arnold @ 2005-12-18 19:14 UTC (permalink / raw)


IntermediateAlgebraText $ find . -name "*.tex" | xargs sed -i '/% 
output=pdf/d'
sed: 1: "./book.tex": invalid command code .

MacOSX Tiger

On Dec 18, 2005, at 11:05 AM, VnPenguin wrote:

> On 12/18/05, David Arnold <dwarnold45@cox.net> wrote:
>> All,
>>
>> How would I use sed to erase %output=pdf from any file ending
>> with .tex in the current directory and any subdirectories below it?
>
> Delete the line containing %output=pdf:
>
> $ find . -name "*.tex" | xargs sed -i '/%output=pdf/d'
>
> Remove only text "output=pdf":
>
> $ find . -name "*.tex" | xargs sed -i 's/%output=pdf/%/'
>
> Try it with a test file before run over all your TeX files :)
>
> HTH,
>
> --
> http://vnoss.org
> Vietnamese Open Source Software Community
> _______________________________________________
> ntg-context mailing list
> ntg-context@ntg.nl
> http://www.ntg.nl/mailman/listinfo/ntg-context

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: sed question
  2005-12-18 19:14   ` David Arnold
@ 2005-12-18 19:26     ` Radhelorn
  2005-12-18 19:32       ` David Arnold
  2005-12-18 19:34       ` Taco Hoekwater
  0 siblings, 2 replies; 9+ messages in thread
From: Radhelorn @ 2005-12-18 19:26 UTC (permalink / raw)


David Arnold wrote:
> IntermediateAlgebraText $ find . -name "*.tex" | xargs sed -i '/% 
> output=pdf/d'
> sed: 1: "./book.tex": invalid command code .
> 

Strange. Command is valid and works for me.

-- 
Radhelorn <radhelorn@mail.ru>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: sed question
  2005-12-18 19:26     ` Radhelorn
@ 2005-12-18 19:32       ` David Arnold
  2005-12-18 19:34       ` Taco Hoekwater
  1 sibling, 0 replies; 9+ messages in thread
From: David Arnold @ 2005-12-18 19:32 UTC (permalink / raw)


I'll post on the MacOSX-TeX list and see what's up with this command.

On Dec 18, 2005, at 11:26 AM, Radhelorn wrote:

> David Arnold wrote:
>> IntermediateAlgebraText $ find . -name "*.tex" | xargs sed -i '/%  
>> output=pdf/d'
>> sed: 1: "./book.tex": invalid command code .
>
> Strange. Command is valid and works for me.
>
> -- 
> Radhelorn <radhelorn@mail.ru>
> _______________________________________________
> ntg-context mailing list
> ntg-context@ntg.nl
> http://www.ntg.nl/mailman/listinfo/ntg-context

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: sed question
  2005-12-18 19:26     ` Radhelorn
  2005-12-18 19:32       ` David Arnold
@ 2005-12-18 19:34       ` Taco Hoekwater
  2005-12-18 23:03         ` David Arnold
  1 sibling, 1 reply; 9+ messages in thread
From: Taco Hoekwater @ 2005-12-18 19:34 UTC (permalink / raw)


Radhelorn wrote:
> David Arnold wrote:
> 
>> IntermediateAlgebraText $ find . -name "*.tex" | xargs sed -i '/% 
>> output=pdf/d'
>> sed: 1: "./book.tex": invalid command code .
>>
> Strange. Command is valid and works for me.

Depending on your shell, you may want to use *.tex without quotes?

Taco

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: sed question
  2005-12-18 19:34       ` Taco Hoekwater
@ 2005-12-18 23:03         ` David Arnold
  0 siblings, 0 replies; 9+ messages in thread
From: David Arnold @ 2005-12-18 23:03 UTC (permalink / raw)


It "finds" ok, just something later goes wrong:

IntermediateAlgebraText $ find . -name "*.tex" | xargs
./book.tex ./bookenv.tex ./chapter1/chapter1.tex ./chapter1/ 
section1.tex ./chapter1/section2.tex ./chapter1/section3.tex ./ 
chapter2/chapter2.tex ./chapter3/chapter3.tex ./chapter3/junk.tex ./ 
chapter3/section1.tex ./chapter3/section2.tex ./chapter3/ 
section3.tex ./chapter3/section4.tex ./chapter3/section5.tex ./ 
chapter4/chapter4.tex ./chapter5/chapter5.tex ./chapter6/ 
chapter6.tex ./chapter7/chapter7.tex ./chapter8/chapter8.tex

Aha! Got it! Needs the switch -e.

IntermediateAlgebraText $ find . -name "*.tex" | xargs sed -i -e '/% 
output=pdf/d'



On Dec 18, 2005, at 11:34 AM, Taco Hoekwater wrote:

> Radhelorn wrote:
>> David Arnold wrote:
>>> IntermediateAlgebraText $ find . -name "*.tex" | xargs sed -i '/%  
>>> output=pdf/d'
>>> sed: 1: "./book.tex": invalid command code .
>>>
>> Strange. Command is valid and works for me.
>
> Depending on your shell, you may want to use *.tex without quotes?
>
> Taco
>
>
> _______________________________________________
> ntg-context mailing list
> ntg-context@ntg.nl
> http://www.ntg.nl/mailman/listinfo/ntg-context

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2005-12-18 23:03 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-12-18 18:01 sed question David Arnold
2005-12-18 18:53 ` Taco Hoekwater
2005-12-18 19:07   ` David Arnold
2005-12-18 19:05 ` VnPenguin
2005-12-18 19:14   ` David Arnold
2005-12-18 19:26     ` Radhelorn
2005-12-18 19:32       ` David Arnold
2005-12-18 19:34       ` Taco Hoekwater
2005-12-18 23:03         ` David Arnold

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).