@# Quotes DB     useful, funny, interesting





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


Comments:

<0> hey, i want to generate a mysql file and need to print '
<0> cat jiratickets-new.txt |awk -F"|" '{print "UPDATE ticket SET freekeytext5 = "$4" WHERE id = "$2";"}'
<0> so i have to print a ' before and after the variables, can anybody help me?
<1> pcb-dennis, that's a shell-quoting issue.
<0> Rado i got it
<0> i used " instead of '
<0> but thanks a lot :)
<1> pcb-dennis, sure changing just this doesn't conflict with other " occurances?



<0> cat jiratickets-new.txt |awk -F"|" '{print "UPDATE ticket SET freekeytext5 = \""$4"\" WHERE id = \""$2"\";"}'
<0> with this command it walked
<0> arg
<0> it worked
<1> Ah fine, you noticed that...
<0> yes...the german "damit lief es" ^^
<1> pcb-dennis, ... but why you have double "" ... when you \" the string may continue.
<1> "notice" was for "\" not "worked".
<1> German: I know, that's why it was funny.
<1> /who rado
<0> when i dont double them it will print $4 and $2
<0> and not replace the variables
<1> pcb-dennis, sorry, mistook what you were aiming for, you're right.
<0> worked great now :)
<0> my mysql-DB is reorganised now :)
<2> ps aux | awk -v USER=$USER -v UID=$UID '{ if ($1 == USER) {print} if ($1 == UID) {print}}'
<2> mmh, exist another more correct way to say "if found $USER or found $UID, then print line" ?
<1> "\$1 ~ /^($USER|$UID)\$/ {print}"
<3> I'm trying to do something pretty basic in awk: print out field 1, and all fields starting from field 4. Is there a way to do this if the number of fields is unknown? Example: awk '{print $1 $4 $5 $6 $7 $8 }' is possible of course, but isn't there a better way? Something like awk '{print $1 $4-}'
<1> Ludootje, "man awk" search for "for"
<3> thanks rado. seems a lot more complex, but I'm looking into it, tnx
<1> Ludootje, read /topic
<3> yep, I'm reading it. it still seems kinda complicated :) well, the for works, but now it's newlines I'm fighting
<3> I guess I'll just put in a ton of $x's. It seems kinda weird that this behaviour isn't possible in awk. Well, obviously I'm not very familiar with it so maybe I'm judging it incorrectly, but it seems to me that something like '$4-' would be logical to add in awk. I've come across this problem a lot of times already. What I have is a file with different statements on each line. On each line, I want $3 to appear twice. So I could just do: cat foo.txt
<4> use cut
<4> or.
<4> you could try something like this.....
<4> echo "a b c d e f g h" | awk '{$1=$2=$3="\b";print $0}'
<3> that awk example is interesting, goldfish, thanks. seems to useful for my problem, though I have no idea how it works. Still, wouldn't it be logical to implement something in awk to make '$4-' (well, or any equivalent of course) possible?
<4> well, it just sets them all equal to a \b , which is a backspace to your shell, so it deletes them, effictively.
<4> it would be logical



<4> echo "a b c d e f g h" | awk '{for(i=3;i<NF;i++) {printf $i" "} printf "\n"}'
<4> I remember asking this question before, i think i got a solution to it.
<4> other than a for loop, can't really remember i'm afraid, when the awk masters wake up , ask them
<4> paul, tag, pr3d4t0r , etc...
<4> But if you're just using awk for "cutting" the fields like that, I'd use cut until you find the awk solution.
<4> cut -d' ' -f3-
<5> Ludootje: your question is answered in the FAQ mentioned in the topic.
<4> heh.
<5> "How do I print out an arbitrary number of fields in a row, say field 3 to the last field?"
<4> lovely. *goes to read* ty paul
<1> goldfish, d'oh you had to wait for paul to tell you _this_?! :)
<5> :)
<4> hehe
<4> I thought it was going to be something else :)
<1> "it"?
<4> The solution in the faq.
<4> I thought it might have been something other than a for loop.
<1> Well, a FAQ should be always the 1st place to look.
<4> It should.
<4> Ludootje was the one asking the question.....
<1> Ideally helpers should know the toc so they can shout "rtff", while questioneer should try to avoid that by going there on their own.
<4> Ok.
<3> goldfish: sorry was off to eat. yes I could use cut for cutting them, but I also want one of the fields to appear twice, which afaik I can't do with cut.
<3> paul : yes I saw the FAQ, I tried with a for loop but I had issues with newlines. using printf like goldfish showed in his last solution could fix this though, so I don't have to mess with ORS etc.
<4> looks like you're right.
<3> I know, I should've done more research, sorry. I just thought there'd be a simple solution.
<4> You are forgiven by God.
<3> he told you that?
<4> I told myself.
<3> okay
<5> goldfish: you still havn't answered me btw
<4> paul: What was your question?
<5> goldfish: the one I asked in a prayer the other day.
<4> heh
<5> ;)


Name:

Comments:

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






Return to #awk
or
Go to some related logs:

Cannot load session extension. Please check your PHP configuration. suse
precompiled libmp3lame
modprobe saa7134 debian
linux convert a relative path
#sdl
gekkekan
AWLL3026 linux
see thinkCSpy
gentoo gnome-screenshot not found
#web



Home  |  disclaimer  |  contact  |  submit quotes