| |
| |
| |
|
Comments:
<0> hi all.. can I make awk read column by characters instead delimiters? <0> ... <1> you can ***ign characters as delimiters. is that what you mean? <0> beebum, no.
<2> Lin, then you probably want "substr" <0> FIELD1FIELDGREATER2FLD3 <0> 3 fields without separatos. <0> Rado, subst can do it in a single command as: <0> field1,field2,field3=1-5,6-15,16-19 <0> or something like that. <2> Huh? <0> thos isn't a real syntax of anything :-) <2> "man awk" => search for "substr". <0> but If I do with C, I can read the next 5 bytes and set to var1 , next 10 set to var 2 or I can even read and put directly on a struct. <2> C!=awk <0> Rado, I know. I just want to know if awk can do something like that. Just because I found a little problem and I want to know if awk can help me faster than coding in C. <2> Lin, I told you: it can, see "substr". <3> sheeeeeit <3> Lin: substr it is
<3> fws[1] = 5; fws[2] = 9; fws[3] = 3; for (x = i = 1; i < length($0); i += fws[++x]) { F[x] = substr($0, i, fws[x]); } <3> awkbot is dead wtf <0> hmm <0> tag, nice code. <3> awkbot: awkdoc substr <3> err... other way <3> awkdoc substr <4> tag: substr(s, i [, n]) Returns the at most n-character substring of s starting at i. If n is omitted, the rest of s is used. <3> oh both work <3> awkbot: bounce! <3> there she is <3> awkbot: botsnack <4> tag: :-) <3> Lin: it'd be nicer if awk let you define an array all at once ;-)
Return to
#awk or Go to some related
logs:
gentoo gconfd-2 #web #sql after etch sarge cant next outside a loop block perl #awk Useless use of sprintf in void context ubuntu isofs 92 #gentoo KDE seems to be already running
|
|