Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[9fans] Q: awk omit cols

1 view
Skip to first unread message

Peter A. Cejchan

unread,
Nov 19, 2009, 3:39:25 AM11/19/09
to
Hi,

is there any way to print out, e.g. , $2 $3 $4.... $LAST,
i.e., just omitting $1 ?
I was advised to use 'cut' , but, according to plan9 wiki I should use
'awk' for 'cut'...

Thanks,
++pac.


=============================
Petr A. Cejchan
<c...@gli.cas.cz, tya...@gmail.com>
http://home.gli.cas.cz/cej/www/
http://www.facebook.com/cejchan
work: +420-233 087 237
home/SMS: +420-720 121 721
ICQ: 583000501
=============================

Russ Cox

unread,
Nov 19, 2009, 3:55:21 AM11/19/09
to
awk '{print substr($0, 1+length($1)+1)}'

Peter A. Cejchan

unread,
Nov 19, 2009, 5:21:32 AM11/19/09
to
On Thu, Nov 19, 2009 at 9:52 AM, Russ Cox <r...@swtch.com> wrote:
> awk '{print substr($0, 1+length($1)+1)}'
>

Big thank you, Russ, however, wouldn't it be smarter if we had some
kind of 'not' operator here...? Sometimes, especially when you write
the script by hand it is easier to delete few fields than to
explicitly write out all those remaining... IMHO...

++pac

hugo rivera

unread,
Nov 19, 2009, 5:34:51 AM11/19/09
to
I think
awk '{$1="";print}'
should do what you want, provided that you don't care about leading spaces.

2009/11/19 Peter A. Cejchan <tya...@gmail.com>:

--
Hugo

Peter A. Cejchan

unread,
Nov 19, 2009, 5:44:42 AM11/19/09
to
> awk '{$1="";print}'
> should do what you want, provided that you don't care about leading spaces.


really, it works, I have still much to learn, thank you,
Peter, aka ++pac

0 new messages