parallel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Positional arguments in nested parallel


From: Nagesh Adluru
Subject: Positional arguments in nested parallel
Date: Thu, 22 Dec 2022 19:17:24 +0000

Dear Ole, GNU parallel community,

Firstly, I would like to sincerely thank you for building and supporting such a wonderful program. I really love using it. This is my first time asking a question on the forum but I have been using the parallel for years now.

I was wondering how to access positional arguments within the nested parallel. I was trying to use a --rpl within the nested parallel to separate the arguments but the sed logic doesn't seem to be working as expected within that.

parallel -k 'parallel -I // --rpl '\''{i} s:\s.*$::'\'' --rpl '\''{ii} s:[^ ]* ::;s:\s.*::'\'' --rpl '\''{iii} s:.*\s::'\'' echo {1} {i},{ii},{iii} ::: 1 2 :::+ 3 4 :::+ 5 6' ::: A B C D :::+ a b c d

For example, if we use sed we can extract

# a using
echo a b c | sed 's:\s.*$::'
# b using
echo a b c | sed 's:[^ ]* ::;s:\s.*::'
# c using
echo a b c | sed 's:.*\s::'

I do realize there are ways to avoid this situation but I really wanted to try and get positional arguments in the nested parallel approach just for pure curiosity reasons. I also think I don't have the logic fully right in terms of extracting the positional arguments but adventured to ask you and the community about this. Thank you so much for your consideration!

Also, heartiest happy seasons greetings and Happy New Year to everyone!

Sincerely,
Nagesh

reply via email to

[Prev in Thread] Current Thread [Next in Thread]