i need help in sed command problem

i use 'sed' with this syntax

" sed "/$lineerr/d" $fileerr > $fileerr"_Bak" && mv $fileerr"_Bak" $fileerr"

it's work to remove the line that have the word in $lineerr
but it also remove my last line in file too. - -"

my input File

$ cat fileerr.txt
xx|1111111111
xx|2222222222
xx|3333333333
xx|4444444444
nn|4$ 

output File ** $lineerr = "2222222222"

$ cat fileerr.txt
xx|1111111111
xx|3333333333
xx|4444444444
$ 

Thank you very much.
*** this file format must be in the input file format ( not have a new line int the end of file )

Why don't you add a newline to the file?

echo >> file

becuase the output file 'll run in the other system that must have no newline in file

do u have syntax to remove it (newline ) after 'sed' ?
thank you very much ^ ^

awk 'NR==1{printf $0;next}{printf("\n%s",$0)}' file > new_file

Thank you very much :smiley:

You're welcome! :slight_smile: