delete line

data

1
0.65745
0.65745
1
1.27175
1.27175
1.1867
1.1867
1
2448.45
2448.45
1
5.77235
5.77235
1
1.2916
1.2916
1
1.2916
1.2916
1
1.3981
1.3981
1
98.05
98.05
1
6.8311
6.8311
1
8.62905
8.62905
1
3.4137
3.4137

i want to delete the lines with data #1 and only the #1, not all lines that contain #1.

I have tried sed -n '/'1'/p' which deletes all lines that contains the #1. which is not correct.

Somoen please correct the code

thanks

try this

sed '/1$/d' filename

To be even more exact you want to anchor the #1 where it exists on a line by itself, so you need to add the beginning of a line "^" and end of line "$" anchors to your command.

sed '/^1$/d' filename

This command will remove any line that ends with a #1, which will remove the lines that contain 1.3981

sed '/1$/d' filename

using perl:

perl -pi -e 's/^1$//' filename

thanks ldapswandog ..that worked.
thanks yogesh as well