nansat99
1st December 2005, 17:23
I want to remove the spaces from a text file. the file is located at the server. Can anybody tell me the shell command to removed spaces (tabs) from the file?
I tried with $:%s/^M//g filename
Looking for an quick response.
Thanks
Nansat
mark_h
1st December 2005, 18:12
Use vi. Then do :%s/ //g. Only way I know how to do it quick.
Kozure Ohashi
1st December 2005, 19:48
Please try "expand" command.
Regards,
Kozure
NPRao
1st December 2005, 20:10
Try this -
$ tr -d ' ' < file-name > output-file-name
For more info you can look with man tr
tr(1) tr(1)
NAME
tr - translate characters
tr -d [-Ac] string1
-d Deletes all occurrences of input characters or collating elements found in the array specified in string1.
Hitesh Shah
2nd December 2005, 17:57
^M is the line feed character which comes when u transfer windows txt file in binary mode to unix . U can remove ^M by transferring the same in ASCII mode or alternatively use a command like 'dos2unix filename'.
Other suggestions too seem to be valid .