Code Comments
Programming Forum and web based access to our favorite programming groups.hi all,
is there a way to create an awk script that can handle the follwing task:
i got one line (it's my unix/windows PATH variable) that has a delimiter
(":") between each element:
/cygdrive/d/program files/app1:/usr/bin:/sth/else:
what i need to have now is a script that returns me the following
/cygdrive/d/program files/app1
/usr/bin
/sth/else
so that each element is printed in a seperat row. but mention that there
might be blanks ("/cygdrive/d/program files/app1")
within my elements..
thanks in advance
cheers
joerg
Post Follow-up to this messageLe Thu, 28 Apr 2005 19:05:07 +0200, joerg mauz a écrit_:
> hi all,
>
> is there a way to create an awk script that can handle the follwing task:
>
> i got one line (it's my unix/windows PATH variable) that has a delimiter
> (":") between each element:
>
> /cygdrive/d/program files/app1:/usr/bin:/sth/else:
>
> what i need to have now is a script that returns me the following
>
> /cygdrive/d/program files/app1
> /usr/bin
> /sth/else
>
> so that each element is printed in a seperat row. but mention that there
> might be blanks ("/cygdrive/d/program files/app1")
> within my elements..
>
> thanks in advance
>
> cheers
> joerg
Just use RS properly :
$ echo "/cygdrive/d/program files/app1:/usr/bin:/sth/else:" | awk
'{print}' RS=":" /cygdrive/d/program files/app1
/usr/bin
/sth/else
$ echo "/cygdrive/d/program files/app1:/usr/bin:/sth/else:" | awk '1' RS=":"
/cygdrive/d/program files/app1
/usr/bin
/sth/else
Post Follow-up to this messageit works ! thanks very much !!!
Post Follow-up to this messagePowered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.