I want to remove the trailing spaces from any line of file.
line ending does not follow any pattern.
plz help
root@isau02:/data/tmp/testfeld> od -c infile
0000000 a b c m o n \t \t \n
0000020 f i e l d 1 f i e l d 5 \t
0000040 \t \t \t \t \t \t \t \n
0000057
root@isau02:/data/tmp/testfeld> sed 's/[[:space:]]*$//' infile| od -c
0000000 a b c m o n \n f i e l d 1 f
0000020 i e l d 5 \n
0000026
If your sed version doesn't support the POSIX Character Classes you can use a space and a \t within the square brackets:
sed 's/[ \t]*$//'
Older versions of sed even doesn't recognize the \t as a tab. In that case you can type <Ctrl-V> <TAB> successively instead of \t:
sed 's/[ ]*$//'
Regards
thnx a lot buddy