@# Quotes DB     useful, funny, interesting





Google
 
Web www.quotesdb.info
Undernet  |  EFnet  |  Quakenet  |  Freenode  |  Dalnet  |  Ircnet  |  Galaxynet


Comments:

<0> karsten: :)
<1> So, today's question is ...
<0> pr3d4t0r's ears perk up.
<1> ... in a NIS/NFS environment, Linux, parsing /proc/<PID>/stat, (see man 5 proc) how can I translate a tpgid / tpuid to a human-readable group / user name.
<1> Best I've come up with is: cmd = "ypcat group | awk -F: '$3 == \"" value["tpgid"] "\" {print $1; exit}'
<1> ... then cmd | var
<1> erm. command | getline var
<1> OK, I think I've more-or-less solved the problem...



<1> ... and now am wondering just WTF a "process group ID" is in the context of "& of the process which currently owns the tty that the process is connected to."
<1> (man proc(5)).
<2> how do I awk one field at a time
<2> err
<1> xFlux: awk '{ for( i=0; i<=NF; i++ ) print $i}'
<1> xFlux: ... "how do I print one field at a time"
<2> ok....I tried doing that, but at the same time im looping through a bash script
<1> xFlux: For "one file at a time" RTFM "nextfile".
<1> Um. Orthogonal.
<2> yea
<2> ok...
<1> Bash and awk's loop contexts are entirely seperate.
<2> maybe I should start over and iterate
<1> xFlux: pastebin what you're trying to do.
<2> ok
<1> ... or describe it more accurately and effectively ;-)
<2> ok
<2> http://phpfi.com/194640
<1> xFlux: Try english
<2> lol
<2> ok
<2> I have a file with my station ID's in it
<2> I am trying to parse my virtual host file into seperate files
<2> the only way to parse it, is by awk -F"\n<Virtual"
<2> so....
<2> I need to print the contents of the awk into a file by the station ID
<1> virtual host == apache virtualhost file?
<2> awk [OUTPUT] > WEBN-FM.vh (for example)
<2> yea....not a standard apache config though
<2> its all strictly for <Virtual Host> </VirtualHost> and is seperated by \n
<2> nothing else is contained in it
<2> am I giving enough info?



<1> Yeah, I think.
<1> You can use the print statement to print to a file.
<2> ok cool
<1> print <stuff> >file
<1> printf( <stuff> ) >file
<1> You want to grab file from your virthost definitions.
<2> ok, but how do I get the station id inputted from the other file?
<1> I don't think you need to specify '\n' as a record seperator. Just treat the virthosts differently.
<1> while ( getline < virthostdefs ) { stuff; more stuff }; close( virthostdefs)
<1> xFlux: ... I'd do that in a BEGIN {} block.
<1> How can I get a formatted string, eg: like printf, but ***igned to a variable?
<1> sprintf() doesn't do what I expected.
<1> How can I print a bitmap / binary output. Eg: 6 > 0101
<3> karsten: bits2str() search it on the gawk info pages
<3> or /usr/share/awk/bits2str.awk
<1> AlpT_: Ended up writing my own ;-)
<3> if you don't use bit ops, then bits2str.awk is faster ;)
<1> { while ( d > 0 ) { b = d%2 b; d = rshift(d,1)}; return b }
<1> d == decimal, b == binary
<1> { b=0; while ( d > 0 ) { b = d%2 b; d = rshift(d,1)}; return b }
<1> feh. d=0 should be. Covers null case.
<1> No. Got it right the first time.
<1> OK, this is what I've been working on, looks pretty good: http://channels.debian.net/paste/5119
<1> Parser of /proc/<pid>/stat for Linux (man 5 proc).
<4> yeah fo.
<5> i need to match a field against a fixed string and get the next field. is there a way to get a field's number in the record given its value and that it exists?
<5> i mean is there a way besides iterating over all fields?
<4> tuvwx: no
<0> Bonjour.
<4> How would one embed a regex range, inside a regex range?
<4> like -> /a/,/b/{/c/,/d/} , but only working syntax :-)
<6> goldfish: sed -n '/beginregex/, /endregex/{ /regex1/ p; /regex2/ p; }' filename
<4> in awk !
<4> I did start of in sed, but it looks like I need awk for this problem.


Name:

Comments:

Please enter the result of the sum 63 + 46 (to avoid spam):






Return to #awk
or
Go to some related logs:

better than istanbul screen
#ubuntu
forach (keys $) perl
tm1300 ubuntu
#openzaurus
Moustanfii
fcgi-scripts perl
#css
#perl
Sarge Install sata-CDRom



Home  |  disclaimer  |  contact  |  submit quotes