Here is a weird one...at least for me.
i have a test file where some lines contain the world e-mail followed by some e-mails. I want to remove the last comma (,) character of each of these lines .
I can do this with the below command
cat test.txt |grep emails|sed 's/,$//'
emails= email@example.com, firstname.lastname@example.org,email@example.com
The above command does not save the result so when i add the "-i" on the sed command i get the following error:
cat test.txt|grep emails|sed -i 's/,$//'
sed: no input files
Thats quite normal since the data were piped to sed and were not given from a file in order for sed to save the changes.
How do you overcome this one? Any ideas?