GNU并行:输出每个作业到不同的文件 [英] gnu parallel: output each job to a different file

查看:152
本文介绍了GNU并行:输出每个作业到不同的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想处理具有 AWK 使用平行命令shell脚本这样的文本文件,但避风港'T能够将其每个作业到输出到不同的文件

如果我尝试:

  10序列|平行AWK \\''{如果($ 5个0.4)打印$ 2}'\\'文件{} TXT>文件{}。出

它输出到文件文件{}。出而不是 file1.out file2.out

本教程和手册页还建议我可以用 - 文件,但它只是打印到标准输出

  10序列|平行AWK \\''{如果($ 5个0.4)打印$ 2}'\\'文件{} TXT文件--files {}出来。


解决方案

原来我需要引用了重定向,因为它被平行之外的处理:

  10序列|平行AWK \\''{...}'\\'文件{} TXT。>中文件{}。出

I am trying to process so text files with awk using the parallel command as a shell script, but haven't been able to get it to output each job to a different file

If i try:

seq 10 | parallel awk \''{ if ( $5 > 0.4 ) print $2}'\' file{}.txt > file{}.out

It outputs to the file file{}.out instead of file1.out, file2.out, etc.

The tutorial and man pages also suggest that I could use --files, but it just prints to stdout:

seq 10 | parallel awk \''{ if ( $5 > 0.4 ) print $2}'\' file{}.txt --files file{}.out

解决方案

It turns out I needed to quote out the redirect, because it was being processed outside of parallel:

seq 10 | parallel awk \''{...}'\' file{}.txt ">" file{}.out

这篇关于GNU并行:输出每个作业到不同的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆