cut delimiter and save

i have list of names in a text file and I wanted to delete the commas en every line.

for example: inside the text is a list of names in it with commas after each line. I wanted to delete these commas. which command must I execute for this?

unix,
dale,
shawn,
aaron,
sed 's/,[ \t]*$//' file > temp
mv temp file

thanks for the fast reply. didn't work. what's temp by the way?

temp is a temporary file which stores the edited file. What command did you run? If you don't want to use a temporary file explicitly, try:

echo -e '%s/,[ \t]*$//\nx'|ex file
1 Like

Try like..

sed -e 's/\(.*\),/\1/' test1.txt