'Git diff print only specific information combined

I am trying to create a file which contains the file name and the inner changes only. e.g.

FileName1.jsx
 - let name = this.name;
 + var name = this.name;
FileName2.jsx
 - let age = this.age;
 + var age = this.age;

I manage to get the changed lines with

git diff | grep '^[+|-][^+|-]' > changedlines.txt
 
  - let name = this.name;
  + var name = this.name;
  - let age = this.age;
  + var age = this.age;

And the changed files with

git diff --name-only --output=changedfiles.txt
  
  FileName1.jsx
  FileName2.jsx

but i cant figure out how to combine them to create the first one... Is there even a way to do this with git?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source