Delete the first known character in a string with sed

yael

How does one delete the first known character in a string with sed?

For example, say I want to delete the first character (which is @) in the string "@ABCDEFG1234"

I want sed to verify whether "@" exists as the first character. If so, it should delete the character.

Pablo

sed 's/^@\(.*\)/\1/'

^ means beginning of the string

@ your known char

(.*) the rest, captured

then captured block will be substituted to output Sorry, can't test it at the moment, but should be something like that

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related