Tuesday, 15 September 2015

Bash - deleting lines that dont start with 2 characters and a space -


I have a text file that has some junk that I need. There are a few lines that contain 2 characters and one place, Then there are other junk words. I need to edit the file and leave these two words on my own. For example,

  a hello how are you how are you doing it is good bb hai  

  aa za bb  

how can i use it sed? They include only lowercase letters thanks!

via sed.

  sed 's / ^ \ ([^] [^] \) [[: blank:]]. * / \ 1 / 'file  

via grep

  grep-ope '^ \ S {2} (? = \ S)' file  

No comments:

Post a Comment