how to remove a variable starting with dot using sed command

Hi,

I want to remove a variable starting with dot(.) in a file using sed command.

aaa
sss
.abc

s/^\.abc/d

I tried this but it didnt worked.

Remove the s in sed command and try, s is for substitute but here you only delete.

sed '/^\.abc/d' inputfile 

# General solution..
sed '/^\./d' inputfile

Hi,

You can better use this.

 sed 's/^\.\(.*\)//g' filename 

Regards,
Indu

Welcome to the forum Indu. Why is that better do you think? The ^ renders the g flag without meaning, since a match can only happen once per line. Also just deleting the first character does not delete the line.

sed 's/^\..*//g' dot

Thank u.I mistook that "." have to be deleted.

Regards,
Indu