LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
LinkBack Search this Thread
Old 02-23-2012, 04:23 AM   #1
mufea
LQ Newbie
 
Registered: Apr 2008
Posts: 6

Rep: Reputation: 0
truncate strings on many lines


Hi,

I have several lines that look likes:

2011.01.04 15:43:13:000 ABCD [DEFGH.IJKL:90] - XXXX [1334]
2011.01.05 13:13:14:198 EXIT [AURA.WHAT:84] - YYYY [5345]
2011.03.04 16:11:32:256 QUIT [COLS.ROWS:13] - ZZZZ [2156]

I want to trim the 3rd column part between dot(.) and colon(:},
and also remove the '[' & ']' bracket, so it will look likes:

2011.01.04 15:43:13:000 ABCD DEFGH:90 - XXXX [1334]
2011.01.05 13:13:14:198 EXIT AURA:84 - YYYY [5345]
2011.03.04 16:11:32:256 QUIT COLS:13 - ZZZZ [2156]

how to trim it ?

thx.

Last edited by mufea; 02-23-2012 at 04:31 AM.
 
Old 02-23-2012, 06:16 AM   #2
cbtshare
Member
 
Registered: Jul 2009
Posts: 561

Rep: Reputation: 42
what do you have so far, then we will chip in to help...
 
Old 02-23-2012, 06:29 AM   #3
grail
Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 7,179

Rep: Reputation: 1781Reputation: 1781Reputation: 1781Reputation: 1781Reputation: 1781Reputation: 1781Reputation: 1781Reputation: 1781Reputation: 1781Reputation: 1781Reputation: 1781
Sed could manage that for you. Have a look here - - >http://www.grymoire.com/Unix/Sed.html
 
  


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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
script to truncate lines containing a ">" character to 40 characters kmkocot Linux - Newbie 9 02-04-2012 06:03 AM
How to remove lines and parts of lines from python strings? golmschenk Programming 3 11-26-2009 11:29 PM
Truncate the Lines from the File saurabhchokshi Programming 7 06-16-2009 09:12 AM
Extract lines containing some strings without affectting sequential order cgcamal Programming 7 11-06-2008 11:57 PM
truncate lines with c alaios Programming 17 08-25-2005 08:51 AM


All times are GMT -5. The time now is 07:34 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