Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

return each elemet from one input line with a newline
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



Report this thread to moderator Post Follow-up to this message
Old Post
joerg mauz
04-28-05 08:57 PM


Re: return each elemet from one input line with a newline
Le 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


Report this thread to moderator Post Follow-up to this message
Old Post
Loki Harfagr
04-28-05 08:57 PM


Re: return each elemet from one input line with a newline
it works !

thanks very much !!!



Report this thread to moderator Post Follow-up to this message
Old Post
joerg mauz
04-28-05 08:57 PM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

AWK archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 09:16 AM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.