@# Quotes DB     useful, funny, interesting





Google
 
Web www.quotesdb.info
Undernet  |  EFnet  |  Quakenet  |  Freenode  |  Dalnet  |  Ircnet  |  Galaxynet
Page: 1 2



Comments:

<0> wel
<0> wlel
<1> wlel
<2> inv_arp[work]: connection problem ?
<1> lol
<2> one page full of this only
<3> hello
<3> i'd like to use "print" on several lines
<3> something like this:
<3> print "int main (void) \
<3> {
<3> return 0; \
<3> }"
<3> (if forgot the '\' after my '{' but you get the point)
<3> with ms-windows gawk, it works
<3> with linux gawk, it complains about "unterminated string" (on the first line)



<3> is there a way to have portable multi-line print ?
<3> i think in any cases, i could use getline with a file containing all my input
<3> well i used "getline", it works but i have to have an external file
<4> could i tell awk to print all arguments above certain arg number, like in "awk '{print $3}'", i want it to print $3 and all above like $4 and $5..etc
<5> Oddmonger, what?
<5> Maybe "printf" with \n?
<5> m0dY, see URLs in /topic, sounds like faq.
<3> Rado: i'd like to print a chunk of text in the "END"
<3> so, for readability purpose, i'd like to write my "print" command like this:
<3> (1) print " \
<3> (2) void myfunc() \
<3> (3) { \
<3> (4) (c code goes here)
<3> (n) }
<3> it works under windows (with mingw and gawk)
<3> does'nt work with linux
<3> never mind, i use getline and an external source file, and it works
<6> im willing to find a way to rename files in a way that it only keeps the 12 last characters, if anyone has somewhere to lead me id be thankful
<7> intruder: dunno about awk, you could use bash parameter expansion
<7> probable easy to do in awk, I just don't know it very well :)
<6> ok thx
<7> ${file:$(( ${#file} - 12))} or somesuch
<6> wow
<6> so i could do something like:
<6> mv $file ${file:$(( ${#file} - 12))}
<6> ?
<7> yep
<7> should probably quote the first "$file"
<7> and spaces will be treated as characters
<6> hrm
<7> even better: ${file: -12}
<7> file=akdjaldsklkddlast.12chars ; echo ${file: -12}
<7> last.12chars
<6> but i'll have to use '$1'last.12chars ?
<6> ill have to do it on multiple files
<7> eh ?
<7> for file in *; do . . .
<6> ohhhh
<6> ok
<7> back up important stuff before trying your one liner on a directory :)
<6> yea im safe :P a created a directory for the situation
<8> moo
<6> seems to works at 80% for now
<6> 100%
<7> 110 %
<7> its growing out of control !
<6> and i just made this
<7> shut down the flux capacitors !
<6> file=$1
<6> file2=${file: -12}
<6> mv $file $file2
<6> it looks crappy do't you think
<7> for i in *; do mv "$i" "${i: -12}"; done
<6> wow
<6> thats a lot better
<6> thats really nice
<6> this was for my mp3 player which scrolls the filename 12 characters at time, so when all your filename contains all the id3 info it takes a while
<7> ah
<6> text tools are so cool



<7> last 12 characters might be a bit funny tho, no ?
<7> wouldn't the 1st 12 give a better idea of the file name ?
<6> filenames are like this: artist_-_album_-_01_-_songtitle.mp3
<6> they are all contained in directories named by their artist name
<6> so
<6> ill be having song titles inside the artist names directory
<6> its perfect
<6> this way the filename doesnt have to scroll
<7> foo="artist_-_album_-_01_-_songtitle.mp3"
<7> echo ${foo/*_}
<7> songtitle.mp3
<6> wow
<6> this is totally insane
<7> if the last bit is song_title.mp3 though it will come out "title.mp3"
<6> not to big problem
<6> too
<6> both solutions are good
<6> gott go
<6> ill be back, cause im becoming a text tools fanatic
<7> have fun
<8> trala
<8> nick nice i have, gg
<8> gbubien, hi
<8> got a script to do for me?
<9> Greeteengs.
<10> "Oddmonger" at 62.161.252.51 pasted "problem with multiline printing" (8 lines, 165B) at http://sial.org/pbot/22198
<3> Rado: i paste a sample of my problem
<5> Oddmonger, why don't you use \n in printf ?
<5> to
<3> it's just for indenting my source code with awk
<5> Oh...
<5> Well, that's completly up to the awk you use.
<5> +e
<3> well, that's odd that i can't use backslashes for multiline commands, isn't it?
<5> No. It may be wide-spread, but not a general rule.
<3> what a shame, the worst is that it works under windows :)
<3> anyway, awk is a nice tool, i should have know it earlier
<3> (/should/would ?)
<3> /know/known
<3> well you got the point
<9> :: yawn ::
<1> {{{ :: hi lol :: }}}
<11> how can I awk a variable vs. a filename?
<1> awk -v awk_var="$VAR" 'BEGIN{print awk_var}'
<11> thanks
<3> heyhey, i found the problem with backslashes
<9> Oddmonger: PEBKAC.
<9> Oddmonger: ;)
<9> Oddmonger: What's up?
<3> i was using a source-file create with ms-windows
<3> so there were \r char at the end of line
<1> nice.
<3> and '\' was not last char
<9> Oddmonger: Microsoft OSs end lines in \r\n.
<9> Oddmonger: The last character is \n.
<1> tr -d '\r' < gay_windows_file > TMPFILE && mv TMPFILE gay_windows_file
<3> pr3d4t0r: yes but it's after '\' anyway
<3> sed 's/\r//g'
<3> ah yes tr
<3> i always forgot it
<1> Or one could use awk :-)
<3> but i don't know awk enough :)
<1> you could gsub()
<1> eh, use gsub()
<9> goldfish: There was a kid yesterday doing all kinds of crazy things with sed/cut/tr/grep/awk, mixing them up.
<1> It's pretty simple stuff.
<1> pr3d4t0r: Yeah, I saw it :-)
<1> It made me cry.
<9> goldfish: I gave him a full example that I think he liked.


Name:

Comments:

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






Return to #awk
or
Go to some related logs:

#css
string value expected instead
BAIRC bash
gentoo glxinfo: error while loading shared libraries
LoadModule apache2 windows can“t find module
XGetIdleTime
onload=wait
#sendmail
Pyramid Zachman
Enter pass phrase for smtpd.key



Home  |  disclaimer  |  contact  |  submit quotes