| |
| |
| |
|
Comments:
<0> Hola. <1> Bonjour. <2> Guten tag. <3> hi there ;) <1> hello. <3> strange things happen: I'm using { print |& command; command |& getline; print $0; } . On the first line given to the awk script, I get the result, but giving again the same command, nothing is printed. (command is cscope). I've tried putting system("") in various places, but nothing works. What might it be? <3> I'm also using PROCINFO[command, "pty"] = 1 <3> (command = "cscope") <3> ah, ok, getline doesn't understand when 'command' finishes to print to stdout and it waits for more <0> Hrm... Strange things are afoot at the Circle K.
<0> AlpT_: Do you really want to use & in thos pipes? <3> why not? I need a two-way communication <3> yay, found a workaround <3> cscope, at least, tells how many lines it will print. I think the problem for getline is that the last cscope line isn't terminated by a '\n', it's just a '>> ' prompt <3> ehm... <3> <3> alpt@darkalpt:src$ awk -f cscope-wrap.awk -- -blavlas -d oiasjd sad <3> awk: cscope-wrap.awk:3: fatal: cannot open file `-blavlas' for reading (No such file or directory) <3> alpt@darkalpt:src$ awk -f /usr/share/awk/getopt.awk -v _getopt_test=1 -- -blavlas -d oiasjd sad <3> c = <b>, optarg = <lavlas> <3> <3> why? <4> AlpT_: -- means no more args <3> xmb: yea, but as you can see, in the first command it doesn't accept it, while in the second it works <5> pondering.. can one execute programs from awk? I have shell scripts that are 95%+ awk, so why not just use "#! /bin/env gawk".. but I need to get output from external programs <3> kolla: sure you can <3> see |& <3> or in info gawk: 3.8.7 Using `getline' from a Coprocess <5> hm <3> and also "10.2 Two-Way Communications with Another Process" <5> cool <5> thanks :) <0> kolla: #!/usr/bin/awk -f <0> kolla: That's what POSIX likes. <5> yes, found that <5> and "BEGIN" {}" instead of just "{}" :) <5> so it doesnt wait for input <6> whats wrong with this: <6> '{if($4 = 0) print $1}' <7> == <6> i did that. guess i have a lot more ftp users then i thought <1> warez monkey. <0> Greetings. <1> gr33tz <8> What's the best way to invoke an awk script *and* source a shell environment first?
<8> We've got a rather complicated NSF / automount dohicky here, there's a shared profile I want to try loading w/ my awk script. Could just write a shell wrapper.... <8> .... or reference it in my ~/.bashrc I suppose. <8> Hrm. <0> karsten: I'll be happy to help if you're still around. I was out eating my lunch :) <8> pr3d4t0r: So, I thought I might be able to do something with env, but I'm not clear on all the tricks which can be played with it yet. <8> pr3d4t0r: Tried setting BASH_ENV and/or sourcing the systemwide init in my .bashrc, but apparently _that_ is only read for interactive sessions. The use of $BASH_ENV is supposed to override that but didn't. <0> karsten: #!/usr/bin/awk -f <8> I've got some shell-outs to read data from system commands. <8> We're highly heterogenous and NFS-based, so some commands live in host/architecture-dependent locations. <8> pr3d4t0r: Just making clear that I'm using gawk here. <0> karsten: So? <0> karsten: ls -al /usr/bin | grep awk <0> karsten: Tell me what you find. <8> So refers to gawk or host/arch-dep locations. <8> awk => gawk. On this host. <8> We've got a lot of hosts, though, I'm invoking gawk specifically. Not all of 'em have awk == gawk. <8> So I'm actually specifying gawk on a common NFS mount. <8> ... which while not directly related to the problem at hand stems from a common root: we've got five different OSs, multiple architectures of most, on an NFS automounter scheme, and PATH needs to be set depending on which OS, arch, etc., you're on. <8> So there's a common profile that I'm trying to source so that my shell calls get the right command. Paths differ such that I can't hardcode in paths. <8> The trick I need to do is to get that shell init out of the way _before_ I invoke awk (whatever version of awk it may be). <8> Running scripts as cronjobs is failing due to missing commands (like the ones I need to get information about the cluster from). <8> See above for what happens when I attempt to do this from within bash initialization. <8> Hrm. <8> Crap. Shell isn't bash. Hrm. <2> rc is the one true shell. <8> (side note: because of heterogeneity, user shell is generally set to a minimum common standard, generally csh. Yes, /bin/sh is available, but it's not "standard" for user shells here and I'd like to minimize breakage). <8> newmanbe: rc? <2> From Research UNIX/Plan 9./ <0> karsten: Dang. <2> s/\/$// <0> karsten: OKi, so what's the question, out of all that? <0> karsten: The initialization bit? <8> pr3d4t0r: How can i invoke a given environment configuration in such a way that it's available when I run awk, regardless. <8> Yeah. <8> I just realized that I need to hit the csh profile, not the bourne profile, so let me try that. I thought I already was.... <0> karsten: /join #bash <8> ;-) <8> pr3d4t0r: csh, actually ;-) I'll beat on this a bit more.
Return to
#awk or Go to some related
logs:
#linux #perl class static functions in python #oe OPC failed ubuntu #php \index of aXXo
slap_startup failed -u switch WoW Atrix fglrx error inserting permission
|
|