For Programmers: Free Programming Magazines  


Home > Archive > AWK > November 2004 > Deleting the first n characters of a field









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Deleting the first n characters of a field
Joe Farish

2004-11-16, 6:50 pm

I have some data in the following format:

(Script(ID-VG))

I want to be able to remove the "(Script" part at the start of the
field. Does anyone know how to do this?

I know its possible to remove the last n characters of the field
because I can allready do this using the length command.

Thanks in Advance

JAF
Robert Stearns

2004-11-16, 6:50 pm

$i = substr($i,8)

Joe Farish wrote:

> I have some data in the following format:
>
> (Script(ID-VG))
>
> I want to be able to remove the "(Script" part at the start of the
> field. Does anyone know how to do this?
>
> I know its possible to remove the last n characters of the field
> because I can allready do this using the length command.
>
> Thanks in Advance
>
> JAF


Ed Morton

2004-11-16, 6:50 pm



Joe Farish wrote:

> I have some data in the following format:
>
> (Script(ID-VG))
>
> I want to be able to remove the "(Script" part at the start of the
> field. Does anyone know how to do this?
>
> I know its possible to remove the last n characters of the field
> because I can allready do this using the length command.
>
> Thanks in Advance
>
> JAF


gawk '{sub(/\([^(]*/,"")}1'

Ed.
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com