It is not clear what exactly you want to do. Here are some tips that can help:
To remove the repeated space:
> cat file | tr -s " "
To remove the leading and tailing spaces:
> cat file | sed "s/^ *//g" | sed "s/ *$//g"
To remove the blank line from a file:
> cat file | grep -v '^$'
You can use awk and regular expression to do this type of things.
- MS
__________________
"All my technical advices in this forum must be consulted with and approved by a local registered professional engineer before implementation" - Mohammed Samad (Linkedin Profile: http://www.linkedin.com/in/msamad)
(there is a space before * and no space between //)
This will remove all spaces from the file.
- MS
__________________
"All my technical advices in this forum must be consulted with and approved by a local registered professional engineer before implementation" - Mohammed Samad (Linkedin Profile: http://www.linkedin.com/in/msamad)
There is not a single command that will do a complex search and replace. But you can look up how to grep, sed, and awk if must stick with raw unix. You can appropos them to find out how to use them.
Good Answers: