simple awk question

simple awk question

am 20.10.2003 10:17:58 von urgrue

how can i print all BUT the last field. ie something like:
echo one.two.three.four | awk -F "." '{print }'
=one.two.three
-
To unsubscribe from this list: send the line "unsubscribe linux-admin" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html

Re: simple awk question

am 20.10.2003 22:19:37 von Chuck Campbell

On Mon, Oct 20, 2003 at 11:17:58AM +0300, urgrue wrote:
> how can i print all BUT the last field. ie something like:
> echo one.two.three.four | awk -F "." '{print }'
> =one.two.three

echo one.two.three.four | awk -F "." \
'{for (i=1; i


-chuck
--
ACCEL Services, Inc.| Specialists in Gravity, Magnetics | 1(713)993-0671 ph.
2401 Fountain View | and Integrated Interpretation | 1(713)993-0608 fax
Suite 320 | |
Houston, TX, 77057 | Chuck Campbell | campbell@accelinc.com
| President & Senior Geoscientist |

"Integration means more than having all the maps at the same scale!"
-
To unsubscribe from this list: send the line "unsubscribe linux-admin" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html

Re: simple awk question

am 20.10.2003 23:09:55 von Chuck Campbell

On Mon, Oct 20, 2003 at 11:17:58AM +0300, urgrue wrote:
> how can i print all BUT the last field. ie something like:
> echo one.two.three.four | awk -F "." '{print }'
> =one.two.three

Sorry, I didn't test my first one. Your syntax for calling awk was wrong,
and I blindly copied it when I put in my recipe.

This:
echo one.two.three.four | awk -F "." \
'{for (i=1; i
Should actually read:
echo one.two.three.four | awk -F. \
'{for (i=1; i

Please note the -F flag difference in the awk command line.

-chuck


--
ACCEL Services, Inc.| Specialists in Gravity, Magnetics | 1(713)993-0671 ph.
2401 Fountain View | and Integrated Interpretation | 1(713)993-0608 fax
Suite 320 | |
Houston, TX, 77057 | Chuck Campbell | campbell@accelinc.com
| President & Senior Geoscientist |

"Integration means more than having all the maps at the same scale!"
-
To unsubscribe from this list: send the line "unsubscribe linux-admin" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html

Re: simple awk question

am 21.10.2003 16:51:58 von Chuck Campbell

On Mon, Oct 20, 2003 at 04:09:55PM -0500, Chuck Campbell wrote:
> On Mon, Oct 20, 2003 at 11:17:58AM +0300, urgrue wrote:
> > how can i print all BUT the last field. ie something like:
> > echo one.two.three.four | awk -F "." '{print }'
> > =one.two.three
>
> Sorry, I didn't test my first one. Your syntax for calling awk was wrong,
> and I blindly copied it when I put in my recipe.
>
> This:
> echo one.two.three.four | awk -F "." \
> '{for (i=1; i >
> Should actually read:
> echo one.two.three.four | awk -F. \
> '{for (i=1; i >
>
> Please note the -F flag difference in the awk command line.


It appears I was right, wrong and right again. The original posting works
on all variants of gawk (gnu awk) and nawk I have available.

The second posting is required if you happen to be on Solaris, and are using
normal awk, however both work fine on Solaris using gawk or nawk.

Thanks to those who pointed out my error(s).

-chuck


--
ACCEL Services, Inc.| Specialists in Gravity, Magnetics | 1(713)993-0671 ph.
2401 Fountain View | and Integrated Interpretation | 1(713)993-0608 fax
Suite 320 | |
Houston, TX, 77057 | Chuck Campbell | campbell@accelinc.com
| President & Senior Geoscientist |

"Integration means more than having all the maps at the same scale!"
-
To unsubscribe from this list: send the line "unsubscribe linux-admin" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html