Dear Yichao,

Ah.  That makes sense now.   Thank you.

-Mike


On Wednesday, February 3, 2016 at 3:33:11 PM UTC-8, Yichao Yu wrote:
>
> On Wed, Feb 3, 2016 at 6:01 PM, Michael Wojnowicz <mwoj...@uci.edu 
> <javascript:>> wrote: 
> > Hi Julia Users, 
> > 
> > 
> > I'm running Julia 0.3.8, commit 507821*. I want to search through a csv 
> to 
> > find line numbers of rows which match an expression, in this case "=", 
> and 
> > then save the resulting row indices to a file. 
> > 
> > 
> > In terminal, I can do this: 
> > 
> > grep -n -v "=" 20150817global.json.mv.fvm.exported.csv | awk -F: '{print 
> > $1}' > ctsfeats.csv 
> > 
> > In Julia version 0.3.8, the pipeline function did not yet exist.  There 
> is, 
> > though, a |> command for piping.  However, the command 
> > 
> > cmd=`grep -n -v "=" 20150817global.json.mv.fvm.exported.csv` |> `awk -F: 
> > '{print $1}' > ctsfeats.csv` 
> > 
> > run(cmd) 
> > 
> > fails with messsage 
> > 
> > awk: cmd. line:1: fatal: cannot open file `>' for reading (No such file 
> or 
> > directory) 
> > 
> > ERROR: failed process: Process(`awk -F: '{print $1}' > ctsfeats.csv`, 
> > ProcessExited(2)) [2] 
> > 
> >  in pipeline_error at process.jl:515 
> > 
> >  in run at process.jl:479 
> > 
> > 
> > I had originally posted this question in the wrong place (in the 
> "issues" 
> > forum), where Matt Bauman was kind enough to offer the advice to also 
> pipe 
> > to the file, a la 
> > 
> > `grep …` |> `awk …` |> "ctsfeats.csv" 
>
> `<cmd>` returns a command object so don't change the normal double 
> quote for filename to backtick if you want to redirect it to a file 
> instead of a command of that name. 
>
> > 
> > 
> > However,  this command also fails 
> > 
> > cmd=`grep -n -v "=" 20150817global.json.mv.fvm.exported.csv` |> `awk -F: 
> > '{print $1}'` |> `ctsfeats.csv` 
> > 
> > with error message 
> > 
> > julia> run(cmd) 
> > 
> > ERROR: could not spawn `ctsfeats.csv`: no such file or directory 
> (ENOENT) 
> > 
> >  in _jl_spawn at process.jl:217 
> > 
> >  in spawn at process.jl:348 
> > 
> >  in spawn at process.jl:260 
> > 
> >  in spawn at process.jl:389 
> > 
> >  in run at process.jl:478 
> > 
> > 
> > Does anybody have any ideas? Please excuse my relative naivete; my 
> training 
> > in in mathematics and statistics, not computer science. 
> > Thanks for your time. 
> > 
> > -Mike 
> > 
> > 
>

Reply via email to