Sed adds content below a line

the requirement is to add new content below a line

CentOS

related codes

sed-I"Nbat / Target text 1Universe a\ / / ancymocknreturn add new content 1" file_path

sed-I"Nbat / Target text 2Universe a\ / / ancymocknreturn add new content 2 "file_path

expected results

Target text 1
/ / ancymock
return new content 1

Target text 2
/ / ancymock
return new content 2

actual results

Target text 1
/ / ancymock
return new content 1

Target text 2
(with a blank line)
/ / ancymock
return new content 2

when the same sed logic is appended to the second target document, a jump line appears. Sometimes I really think rlgl

Sed
Jan.08,2022

$ cat /alidata/abc.txt
abc
My test text

sed -i "$ a\" /alidata/abc.txt

$ cat /alidata/abc.txt
abc
My test text

=

-sharp cat abc.txt
Some text
Random
[option]
insert text here
Some stuff

-sharp sed '/^Some text/{N;s/$/\nadd new line/}' abc.txt
Some text
Random
add new line
[option]
insert text here

add-I to modify the original file.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e61c26-44e9c.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e61c26-44e9c.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?