@# Quotes DB     useful, funny, interesting





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


Comments:

<0> I need a awk line to get out all ip numbers out of a file, any sugestions?
<1> ll
<1> oops
<2> how do I use a var in gsub ?



<3> gsub(foo, bar, my_var)
<3> if you mean a variable in the regex, you could try gsub("foo"my_var"bar", baz, my_var) and if that doesn't work, you can use sprintf() to build the regex string
<2> I don't need -v my_var=blah ?
<3> if that's what you need to do, sure
<2> don't laugh :P but I want to do something like:
<2> echo "One liner"| awk -v var="or more" '{gsub(/One/, "Two\n$var"); print}'
<2> Two or more liner
<3> i'm not sure you can operate on more than one line at a time
<2> well, the \n works, but not the var
<3> echo foo bar | awk -v baz="foo" '{gsub(baz" bar", "Hello, World!", $0); print}'
<3> Hello, World!
<3> loose the $
<3> "Two\n"var);



<2> sweet, that works, needed those quotes, I had tried without the $ before
<2> thanks a lot
<3> np
<2> damn, he has two sed expressions on the same line. How about multiple gsubs operating on the same input ?
<3> multiple calls the gsub
<3> on the same variable
<3> not sure what you mean
<2> substitutions for several expressions, like gsub(/foo/, bar) gsub(/baz/, foobar)
<2> spose I could just pipe it
<4> Greetings.
<5> ANYONE need a sc ript ?
<6> haha
<5> is oucht
<7> again?


Name:

Comments:

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






Return to #awk
or
Go to some related logs:

multiverses universe ubuntu
svn method not allowed quakenet
#debian
_Caleb_
#math
#linux
bash without eval
suse linux kdelibs permission denied installing
mac gimp install manuals
#perl



Home  |  disclaimer  |  contact  |  submit quotes