Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to cat/echo multiple entries into a string?

Status
Not open for further replies.

whatisthis987

IS-IT--Management
Apr 24, 2007
34
US
I have a file which contains one name in each line. I would like to cat/echo all the names to one single line. How do I do that?

For example,
From:
ALAN
ALEX
BEN

To:
ALAN ALEX BEN

Please help. Thanks.
 
In a ksh-like shell:
echo $(</path/to/from)

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Thank you guys. Both methods work. This is so much easier than the foreach+printf method.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top