1

Okay, so, contrived example here, but it's the simplest instance I could come up with the produces the conditions I'm trying to alter.

I'm trying to run a black-boxed command and alter the multi-line output. So say git diff --name-only, which outputs each uncommitted file that has been altered in the current branch, one per line:

/my/path/altered-file.ex1
/my/path/altered-file.ex2
/my/path/altered-file.ex3

Now, assuming I'm NOT trying to run any tests on them (e.g. there will be no "only style this line's filename if...") and that I simply wish to modify - cosmetically - the way ALL of them are being outputted to the screen:

   -=> /my/path/altered-file.ex1 <=-
   -=> /my/path/altered-file.ex2 <=-
   -=> /my/path/altered-file.ex3 <=-

and/or possibly color them, yellow, let's call it (again: contrived example here), operating with that same assumption that each line will get the same cosmetic treatment as all the others (that is to say, ALL will be yellow and/or ALL will get the same formatting pre/appended).

I'm CERTAIN there's some mechanism to pipe the command into something (xargs? awk? tput? hell, some echo syntax I'm simply too hungover to dredge up?) that'll vomit them, formatted, right back out again (I KNOW this is a boneheaded question, but I've been tearing my hair out for a good half hour here; for the life of me I cannot seem to press-gang my brain into getting anything to WORK, lol).

Anyone got any good suggestions?

NerdyDeeds
  • 111
  • 1
  • MOD: I'm not sure if it was more appropriate to stuff this here or in the *NIX Exchange. I'm working on the server, so that was where my brain went. I'll relocate it if this is the wrong namespace. – NerdyDeeds Sep 25 '22 at 22:36

0 Answers0