Searching through forum I found "sed 's/[ \t]*$//'" can be used to remove trailing whitespaces and tabs from file. The command works fine but I see minor issue as below. Can you please suggest if I am doing something wrong here.
$ sed "s/[ "$'\t'"]$//" a.txt
upg_prod_tes
upg_prod_new
$ sed "s/[ "$'\t'"]*$//" a.txt
upg_prod_tes
upg_prod_new
Not sure if I would be able to make use the second option suggested as the "sed" is part of a SH which is copied from another server using scp command line.