The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #7 (permalink)  
Old 06-24-2006
System Shock's Avatar
System Shock System Shock is offline Forum Advisor  
Registered User
  
 

Join Date: May 2006
Location: Tau Ceti V
Posts: 521
Quote:
Originally Posted by yoavbe
Hi All,

Jim suggetsion: tr -s '\n' ',' < oldfile > tmpfile is almost perfect.
Its add an extra ',' at the end of the file:
'/ttt/aaa','/ttt/bbb','/ttt/ccc','/ttt/ddd','/ttt/eee',
Any suggestion how to remove it ?

Thank You !!!
Here's another way to do it:

Code:
set -A FILE $(cat text.file)
echo ${FILE[@]} | sed 's/ /,/g' > file.txt
Without the pipe to sed, you'll get blank spaces in between values