943,865 Members | Top Members by Rank

Ad:
Jun 11th, 2007
0

Reading through lines of text file sequencially

Expand Post »
I have a text file with hundreds of names i would like to search in the database, yet to perform this query the names have to be on one line separated by commas. the text file is as follows

Mike
Ralph
Cindy
Claire
John

the output i need is

Mike,Ralph,Cindy,Claire,John

Any help on scripting this ?

Thanks
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
slbit is offline Offline
7 posts
since Jun 2007
Jun 11th, 2007
0

Re: Reading through lines of text file sequencially

Shell Scripting Syntax (Toggle Plain Text)
  1. tr '\n' ',' < file
Reputation Points: 75
Solved Threads: 44
Junior Poster
ghostdog74 is offline Offline
156 posts
since Apr 2006
Jun 12th, 2007
0

Re: Reading through lines of text file sequencially

Works Perfectly Thanks
Reputation Points: 10
Solved Threads: 0
Newbie Poster
slbit is offline Offline
7 posts
since Jun 2007

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Shell Scripting Forum Timeline: Concat files with similar names in different directories
Next Thread in Shell Scripting Forum Timeline: Script to compare dates?





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC