[gentoo-user] OT: awk scripting

2006-03-24 Thread Sascha Lucas
Hi list, I want the awk analogon for cut -f2-, which prints fields #2 to #n. Is this possible? awk '{print $2???}' TIA, Sascha. -- gentoo-user@gentoo.org mailing list

Re: [gentoo-user] OT: awk scripting

2006-03-24 Thread Hans-Werner Hilse
Hi, On Fri, 24 Mar 2006 14:34:22 +0100 (CET) Sascha Lucas [EMAIL PROTECTED] wrote: I want the awk analogon for cut -f2-, which prints fields #2 to #n. Is this possible? awk '{print $2???}' I'd do the following: awk '{$1=;print $0}' (awk recalculates $0 when $n is modified) This still

Re: [gentoo-user] OT: awk scripting

2006-03-24 Thread Cláudio Henrique
let's say you have a listing like this in a file name list.txt: aaa bbb aaa bbb aaa bbb aaa bbb aaa bbb if you wanna print the bbb column, you just have to do like this: cat list.txt | awk '{ print $2 }' if the listing is like this: aaa;bbb aaa;bbb aaa;bbb aaa;bbb aaa;bbb then you do:

Re: [gentoo-user] OT: awk scripting

2006-03-24 Thread Boyd Stephen Smith Jr.
On Friday 24 March 2006 07:34, Sascha Lucas [EMAIL PROTECTED] wrote about '[gentoo-user] OT: awk scripting': I want the awk analogon for cut -f2-, which prints fields #2 to #n. Is this possible? I think: awk '{shift; shift; print $0}' -- If there's one thing we've established over the years

Re: [gentoo-user] OT: awk scripting

2006-03-24 Thread Sascha Lucas
On Fri, 24 Mar 2006, Hans-Werner Hilse wrote: awk '{$1=;print $0}' (awk recalculates $0 when $n is modified) This still leaves you with one OFS starting the line (between $1 and $2), you can get rid of this using awk '{$1=;print substr($0,lenght(OFS))}' thanks. the function lenght seems not

Re: [gentoo-user] OT: awk scripting

2006-03-24 Thread Hans-Werner Hilse
Hi, On Fri, 24 Mar 2006 16:15:09 +0100 (CET) Sascha Lucas [EMAIL PROTECTED] wrote: On Fri, 24 Mar 2006, Hans-Werner Hilse wrote: awk '{$1=;print $0}' (awk recalculates $0 when $n is modified) This still leaves you with one OFS starting the line (between $1 and $2), you can get rid of

Re: [gentoo-user] OT: awk scripting

2006-03-24 Thread Hans-Werner Hilse
Hi, On Fri, 24 Mar 2006 08:49:22 -0600 Boyd Stephen Smith Jr. [EMAIL PROTECTED] wrote: On Friday 24 March 2006 07:34, Sascha Lucas [EMAIL PROTECTED] wrote about '[gentoo-user] OT: awk scripting': I want the awk analogon for cut -f2-, which prints fields #2 to #n. Is this possible? I

Re: [gentoo-user] OT: awk scripting

2006-03-24 Thread Sascha Lucas
On Fri, 24 Mar 2006, Hans-Werner Hilse wrote: On Fri, 24 Mar 2006 16:15:09 +0100 (CET) Sascha Lucas [EMAIL PROTECTED] wrote: thanks. the function lenght seems not defined. but substr($0,2) works. That was a typo. Should of course be length. sorry. I was in a hurry and didn't noticed the