Skip to content
This repository has been archived by the owner on Jul 11, 2019. It is now read-only.

Treat each line from stdin or from file list as one argument and use --colsep to split this in multiple arguments if requested. #61

Open
ghuls opened this issue Nov 20, 2017 · 0 comments
Milestone

Comments

@ghuls
Copy link

ghuls commented Nov 20, 2017

Treat each line from stdin or from file list as one argument and use --colsep to split this in multiple arguments if requested.

The current implementation is different from GNU parallel.
Currently each line is split on whitespace.
This leads to unexpected results, as filenames with for example spaces are split in multiple arguments like seen in issue #57

The default argument separator when reading from a file or stdin should be "\n", this should be overridable (like the -0 optiion in GNU parallel) like requested in issue #59

# Input arguments
$ printf '1  2  3\n4\n5\n6  7\n'
1  2  3
4
5
6  7

# GNU Parallel (uses whole line as 1 argument: double spaces).
$ printf '1  2  3\n4\n5\n6  7\n' | parallel 'echo {}'
1  2  3
4
5
6  7

# GNU Parallel (split 1 line on colsep to use as different arguments: single space).
$ printf '1  2  3\n4\n5\n6  7\n' | parallel --colsep ' ' 'echo {}'
1 2 3
4
5
6 7

# mmstick parallel (splits line automatically in different arguments:  single space)
$ printf '1 2 3\n4\n5\n6 7\n' | target/x86_64-unknown-linux-musl/release/parallel 'echo {}'
ion: /sys/kernel/mm/transparent_hugepage/enabled is set to always instead of madvise. This will gravely effect the performance of Parallel.
parallel: reading inputs from standard input
1 2 3
4
5
6 7

GNU parallel --colsep option:

       --colsep regexp
       -C regexp
                Column separator. The input will be treated as a table with regexp separating the columns. The n'th
                column can be access using {n} or {n.}. E.g. {3} is the 3rd column.
                --colsep implies --trim rl.
                regexp is a Perl Regular Expression: http://perldoc.perl.org/perlre.html
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants