regex - Trouble with if command using grep in Terminal -


How do I do something like this?

  "input" | \ If grep -E 'phone_and_fax ":" Phone :. * Fax: 'Then SAD / Phone_ and Fax': "Phone: / | / Ji '| \ Sed '/ Fax: / | / Ji '| \ Sed / original_license_date ":" Date of Original License: / | / G 'elif grep' phone_and_fax ":" Phone: 'then SAD / phone_ and_fax ":" Phone: / | / Ji '| \ Sed / original_license_date ":" Original License Date: / || / G 'elif grep' fax: 'then SAD / phone_and_fax ":" phone: / || / Ji '| \ Sed '/ Fax: / | / Ji '| \ Sed / original_license_date ":" Date of Original License: / | / G 'other sed' s / phone_and_fax ":" phone: / || / Ji '| \ Sed's / original_license_date ":" Date of Original License: / | / G 'fi | \ "Continue script \"  

The issue of taking place or the issue of what is being viewed really does not make any difference. I'm trying to use some piping to handle some of the text, but if runs on a specific method using regex with grep Then then needs to be changed that would be replaced with that specific example but grep should not change piping output. For example, take this pseudo-code:

/ P>

    

code> if grep -E 'something. * Xt '; Then Sad / Something / Some / G '; Fi

It can be translated into a call on sed . Observe:

$ some text resonant sed '/some.exe / s / some / some / g' some text

versus:

  $ echo some test. Sed '/some.exe / s / some / some / g' Some tests  

long example

Consider this pseudo code:

  if grep -E 'something * Xt 'then sed' s / some / some / g 'elif grep' then 'sed' is / is / is / g 'fi. The equivalent  sed  is the statement: 

  sed '/ some * Xt / {s / something / some / g; B f}; / Is / is / is / g; : Fi; S / This / "" / g ' 

Part of the pseudo code alif has been translated into branch description here. If the condition matches /some.xxt / , the replacement is s / some / SOME / g and says bf < To jump on the code> Sed label fi . It makes logical equivalent of the alif statement.

Explains examples in this process:

  $ "Some text is echo". Sed '/some.xxt; {/ Some / some / g; B f}; / Is / is / is / g; : Fi; S / this / "/ g" some text "" $ echo "some test is this" | Sed '/some.xxt; {/ Some / some / g; B f}; / Is / is / is / g; : Fi; S / This / "" / g "is some trial  

Comments