Results 1 to 7 of 7

Thread: Looking for tool to process wildcards, passing filenames to a perl script

  1. #1

    Default Looking for tool to process wildcards, passing filenames to a perl script

    Hi !

    In
    Code:
    /usr/bin/
    I have a symbolic link named
    Code:
    epstopdf
    which points to the perl script
    Code:
    /usr/share/texmf/scripts/epstopdf/epstopdf.pl
    Now I have a larger number of .eps-files that I would like to
    convert to .pdf-files using that perl script
    (because it takes care of the bounding box within the .eps-files).

    But a call of
    Code:
    epstopdf *.eps
    on the command line results in nothing reasonable,
    because that script isn't designed to process wild cards.

    So I have to enter each single file name manually

    Even using copy and paste this isn't funny when I may have to
    process 200 files .....

    So the question:
    Is there a tool that is able to process wildcards and pass the filenames
    found to the pearl script above?

    Many thanks in advance!
    Mike

  2. #2
    Join Date
    Aug 2010
    Location
    Chicago suburbs
    Posts
    12,173
    Blog Entries
    3

    Default Re: Looking for tool to process wildcards, passing filenames to a perl script

    Quote Originally Posted by ratzi View Post
    But a call of
    Code:
    epstopdf *.eps
    on the command line results in nothing reasonable,
    because that script isn't designed to process wild cards.

    So I have to enter each single file name manually
    Assuming that you use "bash" as your shell:
    Code:
    for file in *.eps
    do
      epstopdf $file
    done
    openSUSE Leap 15.1; KDE Plasma 5;

  3. #3
    Join Date
    Feb 2009
    Location
    Spain
    Posts
    25,547

    Default Re: Looking for tool to process wildcards, passing filenames to aperl script

    On 2013-12-07 14:16, ratzi wrote:
    >
    > Hi !
    >
    > In
    >
    > Code:
    > --------------------
    > /usr/bin/
    > --------------------
    >
    > I have a symbolic link named
    >
    > Code:
    > --------------------
    > epstopdf
    > --------------------
    >
    > which points to the perl script


    Didn't you know that there is a dedicated forum here for scripting,
    where people knowledgeable on those things can answer? Why don't you ask
    moderators to move your post there? Use the small triangle button.

    --
    Cheers / Saludos,

    Carlos E. R.
    (from 12.3 x86_64 "Dartmouth" at Telcontar)

  4. #4

    Default Re: Looking for tool to process wildcards, passing filenames to a perl script

    Quote Originally Posted by nrickert View Post
    Assuming that you use "bash" as your shell:
    Code:
    for file in *.eps
    do
      epstopdf $file
    done
    Great !

    Taking your code I wrote alleps.sh:
    Code:
    #!/bin/bash
    
    for file in *.eps
    do
      epstopdf $file
    done
    placed it in the same directory as the .eps-files,
    and then the call
    Code:
    bash alleps.sh
    did the whole job !

    Many thanks !
    Mike


    @Carlos

    Quote Originally Posted by robin_listas View Post
    Didn't you know that there is a dedicated forum here for scripting,
    where people knowledgeable on those things can answer? Why don't you ask
    moderators to move your post there? Use the small triangle button.
    Hi, no, I didn't know.

    But you probably got me wrong a bit.
    I didn't have any question about that perl script (epstopdf).
    I was looking for a tool that can pass filenames to that script.

    Anyway, it is solved !

    See you
    Mike

  5. #5
    Join Date
    Aug 2010
    Location
    Chicago suburbs
    Posts
    12,173
    Blog Entries
    3

    Default Re: Looking for tool to process wildcards, passing filenames to a perl script

    Quote Originally Posted by ratzi View Post
    Great !

    Taking your code I wrote alleps.sh:
    Code:
    #!/bin/bash
    
    for file in *.eps
    do
      epstopdf $file
    done
    placed it in the same directory as the .eps-files,
    and then the call
    Code:
    bash alleps.sh
    did the whole job !
    Now, may I make a suggestion for your script:

    --- alleps ---
    Code:
    #! /bin/sh -
    for file in "$*"
    do
      epstopdf $file
    done
    Put that script in your $HOME/bin directory, and mark it executable.

    Then just use:
    Code:
    alleps *.eps
    to do what you want.

    You will have created a more flexible tool that does about what you originally tried -- applies to everything in the argument list.

    I began that with "#! /bin/sh -" because it does not use anything that is bash-specific. Any version of the Bourne shell should work.

    Hmm, and now I have demonstrated why Carlos was right, that this is a scripting thread.
    openSUSE Leap 15.1; KDE Plasma 5;

  6. #6
    Join Date
    Feb 2009
    Location
    Spain
    Posts
    25,547

    Default Re: Looking for tool to process wildcards, passing filenames to aperl script

    On 2013-12-07 15:06, ratzi wrote:

    > @Carlos
    >
    > robin_listas;2606035 Wrote:
    >> Didn't you know that there is a dedicated forum here for scripting,
    >> where people knowledgeable on those things can answer? Why don't you ask
    >> moderators to move your post there? Use the small triangle button.

    >
    > Hi, no, I didn't know.


    Next time :-)


    > But you probably got me wrong a bit.
    > I didn't have -any- question about that perl script (epstopdf).
    > I was looking for a tool that can -pass- filenames to that script.


    Ah, I see.

    > Anyway, it is solved !


    Yep.

    --
    Cheers / Saludos,

    Carlos E. R.
    (from 12.3 x86_64 "Dartmouth" at Telcontar)

  7. #7

    Default Re: Looking for tool to process wildcards, passing filenames to a perl script

    Quote Originally Posted by nrickert View Post
    Hmm, and now I have demonstrated why Carlos was right, that this is a scripting thread.
    Seems it has become such

    Thanks again !
    Mike

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •