It works. Thank you.
Hi
Pm4.1LM10m04850 0.24924Pm4.1LM01m05240 0.02328Pm4.1LM01m11200 -0.02328Pm4.1LM01m11050 0.02899Pm4.1LM03m10920 0.04638Pm4.1LM00m08740 -0.04638Pm4.1LM09m10890 0.18085Pm4.1LM05m02500 0.23509Pm4.1LM03m01390
This is my query data above.
I want to exclude those digits that are in bold and the rest in rows like this:
Pm4.1LM10m04850
Pm4.1LM01m05240
Pm4.1LM01m11200
and so on..
I tried using grep command: grep "Pm4.1LM[0-9]" FILENAME of course it didn't work because there is character in between [0-9] pattern I used in command.
Can anyone help please
Appreciated if help is given with bit of detail explanation!!!
Thanks in advance
2 answers
tr " " "\n" < input.txt | sed 's/^[0-9\.\-]*//'
A small educational note: if an answer was helpful, you should upvote it; if the answer resolved your question, you should mark it as accepted. You can accept more than one answer if they work. This will help future users that might find this post find the right answer.

sed -r 's/\s[0-9\.\-]+Pm/ Pm/g' input.txt
outputs: Pm4.1LM10m04850 Pm4.1LM01m05240 Pm4.1LM01m11200 Pm4.1LM01m11050 Pm4.1LM03m10920 Pm4.1LM00m08740 Pm4.1LM09m10890 Pm4.1LM05m02500 Pm4.1LM03m01390
This script uses sed and a regular expression (regex): \s[0-9\.\-]+Pm
This regex matches the number with [0-9\.\-]+ (a series of numerical characters, decimal point and sign) and additional context (space before, "Pm" after)
The sed command replaces this match by only the " Pm" to remove the number.
Log in to answer this question.