1

I want to be able stage specific lines of code that match a pattern (MARKETING_VERSION in my case).

I've got the awk command which will show me the lines that match the pattern MARKETING_VERSION but I don't know how to stage the lines from that result to git.

awk '/MARKETING_VERSION/{print NR}' exampleFile.txt the result in terminal is

1191
1245

How can I use this result to stage those specific lines in that file to git?

I know you can use git add -p but I want to use this in a shell script so I need a non-interactive version.

TIA

Samantha
  • 751
  • 2
  • 6
  • 18

0 Answers0