bash - Process output with `awk` when the command prompts for input with no newlines -


I have a process (Apache Maven) that produces a lot of production, from which I want to paint some parts In particular, if line starts with [INFO] , then I think the initial sub-corner should be in blue, all the other text remains unchanged.

Here is a simplified version of my script: ColorMain :

  #! / Bin / zsh Export BLUE = `Tupet Set 4` Export Reset =` Tupput sgr0` function MVN-color () {(Mvn $ @ | awk "BEGIN {RS = \" \ "}; {sub (/ \ [INFO \ '$ {BLUE} [INFO] $ {RESET} \ "); printf \" \% s \ ", \ $ 0}")} mvn-color originally generated  

Example outputs (all initial [INFO] are colored in the shell), where & lt; Enter & gt; Issue where the program asks for my input:

  $ / Color-maven [INFO] Scanning for projects ... [..cut ...] 1192: Remote - & gt; Uk.ac.rdg.resc: edal-ncwms-based-webapp (-) & lt; Enter & gt; Select number or apply filter: 497: org.apache.maven.archetypes Choose: maven-archetype-quickstart version: 1: 1.1  

above, text select number or filter applied Do: 497: There is an indication for some user input: compare it with normal execution of mvn command without using my script:

  $ Mvn archetype: generated [INFO] scanning for projects ... [... cut ...] 1192: Remote - & gt; Choose Uk.ac.rdg.resc: edal-ncwms-based-webapp (-) Number or Apply Filter: 497: & lt; Enter & gt; Select org.apache.maven.archetypes: maven-archetype-quickstart version: 1: 1.1  

If I type mvn my awk With script? How can I preserve the same output structure of the original mvn command and modify only the initial [INFO] string of all the rows?


Comments

Popular posts from this blog

apache - 504 Gateway Time-out The server didn't respond in time. How to fix it? -

c# - .net WebSocket: CloseOutputAsync vs CloseAsync -

c++ - How to properly scale qgroupbox title with stylesheet for high resolution display? -