bugGNU Parallel - build and execute command lines from standard input in parallel - Bugs: bug #42470, Feature suggestion: replacement...

 
 

bug #42470: Feature suggestion: replacement string for extension

Submitted by:  Zhiming Wang <zmwang>
Submitted on:  Fri 30 May 2014 08:43:53 PM UTC  
 
Category: NoneSeverity: 1 - Wish
Item Group: NoneStatus: Fixed
Privacy: PublicAssigned to: Ole Tange <tange>
Open/Closed: Closed

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

(Jump to the original submission Jump to the original submission)

Tue 15 Jul 2014 05:43:22 PM UTC, comment #7:

Argument preprocessing with Perl is a great idea! Thanks.

Zhiming Wang <zmwang>
Tue 15 Jul 2014 10:01:27 AM UTC, comment #6:

With the new {= perlexpr =} feature you can get the extension like this:

parallel --rpl '{..} s/.*\.//' echo {..} ::: foo.gif

You should feel free to put the --rpl '{..} s/.*\.//' in a profile - possibly your default profile, so that it will always be available to you.

Ole Tange <tange>
Project AdministratorIn charge of this item.
Wed 04 Jun 2014 04:01:12 PM UTC, comment #5:

Good point, I didn't think about that. Then --equal-width would make no sense for piping. Please ignore my ignorance.

Zhiming Wang <zmwang>
Wed 04 Jun 2014 12:59:46 PM UTC, comment #4:

GNU Parallel does not need to know how many jobs to run before starting the first. This is a feature, not a bug.

--equal-width would require GNU Parallel to first find out how many jobs before knowing how many 0's to prepend.

I probably need to see important use cases before this will happen.

Ole Tange <tange>
Project AdministratorIn charge of this item.
Wed 04 Jun 2014 04:06:05 AM UTC, comment #3:

More general syntax is a great idea, although I can't think of any established convention.

A relevant note: it will be great if {#} has an equal width version like `-w/--equal-width' for `seq' (then inline batch renaming will be super easy, saving a `printf' and nasty quoting issues associated with it). However, the usage of this might be very limited.

Zhiming Wang <zmwang>
Wed 04 Jun 2014 12:00:33 AM UTC, comment #2:

Awaiting feed back on http://lists.gnu.org/archive/html/parallel/2014-06/msg00000.html

Ole Tange <tange>
Project AdministratorIn charge of this item.
Fri 30 May 2014 08:45:00 PM UTC, comment #1:

I screwed up the markup, sorry.

Zhiming Wang <zmwang>
Fri 30 May 2014 08:43:53 PM UTC, original submission:

We already have

+verbatim
{} Input line.
{.} Input line without extension.
{/} Basename of input line.
{//} Dirname of input line.
{/.} Basename of input line without extension.
-verbatim

That is to say, if we label dirname with 1, basename without extension with 2, extension with 3, then we already have 123, 12, 23, 1, 2.

Therefore, it might be a good idea to add a replacement string, possibly {..}, for extension.

To give you an idea of why this could be useful, I do batch image processing frequently, for which I rename the images yet preserve the extensions (.jpg, .png, .gif, .tiff, etc.). Extracting the extension is as simple as an awk, but I do it frequently enough so it will be nice to have a replacement string out of box.

Zhiming Wang <zmwang>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by tange (Posted a comment)
  • -unavailable- added by zmwang (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 4 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Tue 15 Jul 2014 10:01:27 AM UTCtangeStatusNone=>Fixed
      Assigned toNone=>tange
      Open/ClosedOpen=>Closed
    Wed 04 Jun 2014 12:00:33 AM UTCtangeSeverity3 - Normal=>1 - Wish

    Back to the top


    Powered by Savane 3.1-cleanup1