LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 09-10-2008, 06:51 PM   #1
kushalkoolwal
Senior Member
 
Registered: Feb 2004
Location: Middle of nowhere
Distribution: Debian Squeeze
Posts: 1,249

Rep: Reputation: 48
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?
 
Old 09-10-2008, 07:15 PM   #2
homey
Senior Member
 
Registered: Oct 2003
Posts: 3,057

Rep: Reputation: 56
Maybe something like this
Code:
awk -F: '{print$2'\t'$3}' file.txt
 
Old 09-10-2008, 07:35 PM   #3
keefaz
Senior Member
 
Registered: Mar 2004
Distribution: Slackware
Posts: 4,327

Rep: Reputation: 71
And for a sed example
Code:
sed 's/ 0:\|://g' file.txt
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Modify a text files with awk/sed/perl climber75 Programming 15 08-05-2008 03:35 PM
parsing text using sed/awk or similar??? freeindy Programming 5 07-24-2008 04:04 AM
bash/sed/awk fill each line in text file with space to fixed length khairil Programming 11 01-09-2008 05:28 AM
awk/sed to grep the text ahpin Linux - Software 3 10-17-2007 12:34 AM
Help with a script to edit text file (awk? sed?) rickh Linux - Newbie 8 04-21-2005 08:24 PM


All times are GMT -5. The time now is 09:13 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration