I searched a lot of posts in the forum about deleting the first character of each line of text, but most of them directly delete the first character of each line without specifying conditions, that is, delete all the first characters regardless of what they are.
Now, I have encountered a tricky problem and specifically ask the experts for help.
That is, first determine whether the first character of each line of text is exactly those specific characters I want to delete. If the first character is those specified characters, delete the character without deleting the line.
I just want to delete the characters themselves whose first character contains the special characters "#" and "?" and "@". Even if there are such characters in other positions in this line, it doesn't matter. Just delete the first character with the specified condition.
For example: In 1.txt
#abcdefgh#1666666@
#12345
?6789
?11111112222?55555?
@6666#777?88888@9999#
Finally, the effect I want to achieve is to be saved in 2.txt
abcdefgh#1666666@
12345
6789
11111112222?55555?
6666#777?88888@9999#
Thank you各位teachers here first. And on the occasion of the New Year, I wish all teachers happiness.
[ Last edited by qianxu on 2011-1-2 at 15:43 ]
Now, I have encountered a tricky problem and specifically ask the experts for help.
That is, first determine whether the first character of each line of text is exactly those specific characters I want to delete. If the first character is those specified characters, delete the character without deleting the line.
I just want to delete the characters themselves whose first character contains the special characters "#" and "?" and "@". Even if there are such characters in other positions in this line, it doesn't matter. Just delete the first character with the specified condition.
For example: In 1.txt
#abcdefgh#1666666@
#12345
?6789
?11111112222?55555?
@6666#777?88888@9999#
Finally, the effect I want to achieve is to be saved in 2.txt
abcdefgh#1666666@
12345
6789
11111112222?55555?
6666#777?88888@9999#
Thank you各位teachers here first. And on the occasion of the New Year, I wish all teachers happiness.
[ Last edited by qianxu on 2011-1-2 at 15:43 ]


