Just use Replace in Files (Edit → Find → Replace in Files, or Ctrl+Shift+R in Windows and Linux / ⌘+Shift+R in Mac) to replace this regex:
(.)\Z
with this:
$1\nThis is your line
in any files you need. That’s all.
Explanation:
The regex (.)\Z matches and captures the last character in the whole file:
(.)matches and captures any character\Zmatches EOF (end-of-file)
And the replacement uses it to add your line after it:
$1uses the first capture group (i.e. the previously matched character, to avoid removing it)\nintroduces a new lineThis is your lineis the line you want to add
You may use the File mask option to select the files you want to change:
Result:
0
solved Add single line at the end of multiple files in IntelliJ

