removing spaces in a file

I have output a file and need to remove blank spaces in the first lines only so the file is left end justified. I need to do this while keeping the rest of the file intact.

Example of file that needs spaces removed:

space
space space
space space space
space space space space
space space space space space

This is how file needs to be:

space
space space
space space space
space space space space
space space space space space

Any help is greatly appreciated

Umm... these two cases look identical... am I missing something here? :confused:

Unfortunately in my example I just noticed I can't put spaces in my sample file. Here is how the file that needs to be left end justified looks (I'm using > to represent a space).

space
>>space space
>>>>>space space space
>>>>>>>>space space space space
>>>>space space space space space

Hey Tioray,

I think you asked me this on Friday... :slight_smile:

Tiotony helped me figure this one out....

sed 's/^[ ]*//g' infile > outfile

Have fun....

:smiley: