SED command to change ./ to a space

Hello, i'm trying to remove the ./ from this file using this SED command:

sed 's/.///g' all3.lst > all4.lst

Does anyone know the correct format for this?

For example, i'm trying to convert ./_ABMSTR.TXT.out to:
_ABMSTR.TXT.out

Thanks very much for you help on this!
BobK
./REVISED/_C5MSTR.TXT.out
./REVISED/_MCMSTR.TXT.out
./_ABMSTR.TXT.out
./_ADMSTR.TXT.out
./_AQMSTR.TXT.out
./_BAMSTR.TXT.out
./_C2MSTR.TXT.out
./_C3MSTR.TXT.out
./_C4MSTR.TXT.out
./_CBMSTR.TXT.out
./_CFMSTR.TXT.out
./_CGMSTR.TXT.out

echo './_ABMSTR.TXT' | sed 's#^[.]/##'

Try this:
sed 's!./!!' input_file > output_file

Wow that's great thanks alot all for the help, works great!

Have a great week!

BobK

Shell_Life, there are a couple of things wrong with that.

  1. '.' will match ANY character so you would be replacing every occurrence of / and its preceding character with a space.
  2. You didn't bind to the start of the line, so if the pattern didn't happen at the start of a line, you could make a replacement in error elsewhere.

reborg, thank you for analizing my solution.

You are absolutely right when you said that I didn't bind to the start of
the line with caract (^) -- when I tought about the solution I was only
looking at the data which every line always begins with "./".

As for the other observation, the solution does not replace "every occurrence"
of "/" in the line -- it only replaces the first one, as I didn't suffixed the "s"
command with "g" -- do you agree?

reborg, you are a real player here -- thank you.

so if the 'first occurrence' happens to be in the middle of a line/string:

$ echo '_ABMSTR./TXT' | sed 's!./!!'
_ABMSTRTXT

Yes, you do need to 'anchor' the regex to the beginning of the line.

Correct, I misspoke, I meant that it would replace the first / and ANY letter preceding it, irrespective of where it happened in the string. Essentially I was commenting on the use of . (if the first / was at the start of the line, it would replace the second / and it's preceding character)

vgersh, the user bobk wrote his request/specification as follows:
"Hello, i'm trying to remove the ./ from this file using this SED command:
...
./REVISED/_C5MSTR.TXT.out
./REVISED/_MCMSTR.TXT.out
./_ABMSTR.TXT.out
./_ADMSTR.TXT.out
./_AQMSTR.TXT.out
./_BAMSTR.TXT.out
./_C2MSTR.TXT.out
./_C3MSTR.TXT.out
./_C4MSTR.TXT.out
./_CBMSTR.TXT.out
./_CFMSTR.TXT.out
./_CGMSTR.TXT.out

From what he wrote, the conclusion is:
Nowhere in his request/specification, he said where the "./" was going to
be located in each record.

One can only make an assumption that the location of the "./" is in the
beginning of each record, by looking at the sample file he gave.

If we can only go for what is written by him and the sample file he gave
as an example, we can also conclude that the "./" will always appear as
the first and second characters in each record, nowhere else.

Consequently, forcing "sed" to search for "./" at the beginning of each
record is meaninless, as we know it will always be there.

For almost every program that is written, several arguments can be made
starting with "what if" that are not in the specifications, such as:
"so if the 'first occurrence' happens to be in the middle of a line/string"

We know this statement is not true, as per bobk specification.

If you want to remove the first two characters from every line:

sed 's/^..//' all3.lst > all4.lst

If you want to remove "./" from the front of every line, but remove nothing if the line doesn't start with "./":

sed 's|^\./||' all3.lst > all4.lst

If you want to remove the first occurrence of "./" from every line (wherever it occurs on the line):

sed 's|\./||' all3.lst > all4.lst

If you want to remove all occurrences of "./" from the file:

sed 's|\./||g' all3.lst > all4.lst

Shell_Life,
based on my own experience, most of the OPs asking how to use regex and/or sed for editing start their queries with the very ambiguous definitions of the 'tasks at hand'. As solutions are proposed, in most cases (not all of them and not all the time) it becomes evident that a simply solutions (without considering the hypotheticals in the form of 'what if) will simply not scale. And the threads will go on and on with the numerous tweaks to the regex along the way.

As I said in most cases the OPs don't "see" the repetitive patterns and cannot identify the 'trends'. So I try to assume the "pattern" if I do see it and in most cases (once again - not all the cases and not all the time) it is what the OPs want.

Once again - "your mileage may vary". You can most certainly approach the answer differently like either your response (making no assumptions) or like what cfajohnson just posted (rephrasing the initial question with different 'twists" and answering them one-by-one in order and let the OP choose the interpretation of his/her/its original question for themselves). BTW, I do prefer the latter (but in most cases I simply don't have the patience to do it consistently) - thanks Chris.

It all comes down to the posting "style". If someone has the desired, the patience and the stamina to answer every OPs question in the very detailed manner - all the power to him/her - it will only benefit the greater community and these forums. I simply try to do my own best in the manner that I find fit based on 2 factors:

  1. time and availibility
  2. judgement call of the original posting - if I feel/see that the OP spent enought time and effort analyzing and phrasing his/her/its question in the detailed manner - it's a clear indication (at least to me) that the OP deserves a detailed thorough answer. On the other hand, if the question is vague (in my eyes), I make my own assumptions based on my own experience and post a 'quick and dirty' solution. In the latter case, the experience shows that most of the OPs are 'transient' and don't care about understanding the specifics of the solution and don't respond with more detailed questions.

Sorry for going on the tangent here.....

vgersh99,
Now I know why you are a moderator!
Your thoughts are logical and precise.
I guess we all agree that the OPs must start with a very clear specification
of what they want, but as we all know, this is almost impossible to have
enforced.
My purpose here is to try to help with what I can and also to learn other
ways of solving problems.
I will continue to offer solutions, having in mind that the OPs requests may
only be the tip of the iceberg of a larger problem.
Thank you for clarifying vgersh99.