I'm using sed to remove only the leading spaces in a file
bash-280R# cat foofile
some text
some text
some text
some text
some text
bash-280R#
bash-280R# sed 's/^ *//' foofile > foofile.use
bash-280R# cat foofile.use
some text
some text
some text
some text
some text
bash-280R#
That works great, however I really don't want to rename the file.
I was hoping this would work
bash-280R# sed 's/^ *//' foofile > foofile
It just overwrites foofile and makes it blank.
Is there a way to get around this and keep the original file name w/ the modification of removing leading spaces.
Thanks for your help. No -i option, looks like I'm stuck renameing the file.
OPTIONS
The following options are supported:
-e script script is an edit command for sed. See USAGE
below for more information on the format of
script. If there is just one -e option and
no -f options, the flag -e may be omitted.
-f script_file Takes the script from script_file.
script_file consists of editing commands,
one per line.
-n Suppresses the default output.