bug-gawk
[Top][All Lists]
Advanced

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

Re: [bug-gawk] how to close pipe?


From: frank ernest
Subject: Re: [bug-gawk] how to close pipe?
Date: Mon, 24 Nov 2014 20:15:13 +0100

> cmd = "grep \"" $1 "\" fn.txt"; cmd | getline var; close(cmd)
> 
> But that's really just about the most terrible way of doing whatever you're 
> trying to there (and you're still missing
> posssible multi-line output from grep). It's very likely that the whole task 
> is solvable entirely with awk alone.


No, that does not help.
Here is the complete gawk script
gawk 'BEGIN{f=""} { if(f != $1) { cmd = "grep -E \"" $1 "\" fn.txt" | getline 
var; close(cmd); system("echo " $1 " >> desc.txt; grep -A 100 \"Description:\" 
'\''" var "/control'\'' >> desc.txt; echo >> desc.txt;"); f=$1; }}' 4.txt
gawk: cmd. line:1: (FILENAME=4.txt FNR=2465) fatal: cannot open pipe `grep -E 
"lsb-rpm" fn.txt' (Too many open files)

It's intended to print out the description section in the control file of 
debian packages provided that the file is in the list of files names fn.txt and 
that the control file is decompressed. It concatenates the info to desc.txt.



reply via email to

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