Hoàng Diễm Quỳnh
New member
How do I remove a trailing space in Unix?
Answer
How to remove the leading and trailing spaces in a file?
Answer
How to remove the leading and trailing spaces in a file?
- awk command: $ awk ‘$1=$1’ file Linux 25 Fedora 40 Suse 36 CentOS 50 LinuxMint 15. …
- sed command: $ sed ‘s/^ *//;s/ *$//;s/ */ /;’ file Linux 25 Fedora 40 Suse 36 CentOS 50 LinuxMint 15. …
- Perl solution: …
- Bash solution: