LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Manipulating Text File with awk or sed (https://www.linuxquestions.org/questions/programming-9/manipulating-text-file-with-awk-or-sed-669047/)

kushalkoolwal 09-10-2008 06:51 PM

Manipulating Text File with awk or sed
 
Hello,

I am in a peculiar situation. I have got a large text file (around 1 GB) which has data in this format:

Code:

      0:55589633:      33
      0:55589634:      40
      0:55589635:      40
      0:55589636:      38
      0:55589637:      33
      0:55589638:      34
      0:55589639:      37
      0:55589640:      40
      0:55589641:      41
      0:55589642:      34
      0:55589643:      35
      0:55589644:      34
      0:55589645:      35
      0:55589646:      34
      0:55589647:      33
      0:55589648:      38
      0:55589649:      33
      0:55589650:      35
      0:55589651:      37
      0:55589652:      34
      0:55589653:      34
      0:55589654:      36
      0:55589655:      36
      0:55589656:      41


and I would like it to appear it as:
Code:

      55589633      33
      55589634      40
      55589635      40
      55589636      38
      55589637      33
      55589638      34
      55589639      37
      55589640      40
      55589641      41
      55589642      34
      55589643      35
      55589644      34
      55589645      35
      55589646      34
      55589647      33
      55589648      38
      55589649      33
      55589650      35
      55589651      37
      55589652      34
      55589653      34
      55589654      36
      55589655      36
      55589656      41

Basically I need to remove the red color parts from the sample entry shown below:
Code:

  0:55589633:     33
How do I do that?

homey 09-10-2008 07:15 PM

Maybe something like this
Code:

awk -F: '{print$2'\t'$3}' file.txt

keefaz 09-10-2008 07:35 PM

And for a sed example
Code:

sed 's/ 0:\|://g' file.txt


All times are GMT -5. The time now is 12:57 AM.