On Mon, Jul 16, 2012 at 6:22 AM, vijai2007 <[email protected]> wrote:
> Dear Ole,
>
> programming is not my strong suite.
> however, I have found GNU parallel to be very useful.. so taking small steps
> to learn it.
> can you let me know how to use the following awk command in a GNU parallel
> syntax with a variable
>
> awk ' {if(NR==1){print $1, $2, $3, $4, $5, $7, $9, $10, $12} {if(NR>1 &&
> $5=="ADD") {print $1, $2, $3, $4, $5, $7, $9, $10, $12}}}' OFS='\t'
> VarA_2012_06_LRM_AgeEV.assoc.logistic > VarA_2012_06_LRM_AgeEV .assoc.txt


Quoting is a bitch. That is why GNU Parallel has --shellquote

Put

  awk ' {if(NR==1){print $1, $2, $3, $4, $5, $7, $9, $10, $12} {if(NR>1 &&
  $5=="ADD") {print $1, $2, $3, $4, $5, $7, $9, $10, $12}}}' OFS='\t'
  VarA_2012_06_LRM_AgeEV.assoc.logistic > VarA_2012_06_LRM_AgeEV .assoc.txt

in the file foo. Then run:

  cat foo | parallel --shellquote

It will give you the line quoted. You probably have to adapt the line a little.


/Ole

Reply via email to