bash - vim and sed single liner: negate search, multiple search the substituted line, open file and highlight in vim editor -


What I want to do in a row is the following:
1. Search file for lines that do not match a pattern In ak.txt, each line is set to \ & lt; Matches the negation \ & gt; \ | : $ sed -n '/.*[-9] [0-9] \ [0-9] [0-9] \ [0-9] [0-9] [0-9] $ / s: *: ... \\\ & LT; & Amp; \\\ & gt; \\\ |: p 'ak.txt

Output:

  \ & lt; Ee integration_01.32.00 \ & gt; \ | \ & LT; Ration_01.2.000 \ & gt; \ | \ & LT; Gon_1.21.000 \ & gt; \ | \ & LT; Dkei_ting-on_1.2.00 \ & gt; \ | \ & Lt; See Integration Instructions & gt; \ |   

Works upwards, I do not want the last two letters on the previous line ... ... 2. Illuminate the substitute line searches for inquiries from 'VIM', error The command is thrown down:

  $ vim -c "/` sed -n '/.* [0-9] [0- 9] \ [0-9] [0- 9] \ [0- 9] [0- 9] [0-9] $ /! S: * *: \\\ & lt; & amp; \\\ & gt; \\\ |: p 'ak .txt` "-C 'set hls' ak.txt   

Error:

  bash :. Unknown history modifier   

I think we got what I am trying to achieve, how do I tell BASH through VIM and SED?

If you should do it in one line, then:

  Sed -n '/.* [0-9] [0-9] \. [0-9] [0-9] \. [0- 9] [0- 9] [0-9] * $ /! {S:. *: \\\ & lt; & Amp; \\\ & gt; \\\ | :; $ S / \\ | $ //; P; } 'Ak.txt   

or:

  sed -n' /.*[0-9] [0- 0- 9] 9] [ 0- 9] \. [0- 9] \ {3 \} * $ /! {S:. *: \\\ & lt; & Amp; \\\ & gt; \\\ | :; $ S / \\ | $ //; P; } 'Ak.txt   

This takes your basic operation, but the group uses { and } for 3 tasks At first your replacement process, unchanged (I had to convert : to / , but did not). The second only matches the last line in the file, and the previous \ | , which seems to be your primary purpose, prints the third operation line.

This problem will run if the last line actually matches dd.dd.ddd (where D represents one digit). If this is a problem, you probably have to use two sed commands (you can write it on a line, if you want but I do not want to write it on a line): < / P>

  sed -n '/.*[0-9] [0-9-9] .. 0-0-9] [0- 0- 9]. ] [0- 9] $ /! S:. *: \\\ & lt; & Amp; \\\ & gt; \\\ |: p 'ak.txt | Sed '$ s / \\ | $ // '  

The first line is absolutely your original order; Second only \ | at the end of the last line deletes it.

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -