LinuxQuestions.org
Register a domain and help support LQ
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
 
Search this Thread
Old 02-23-2012, 05: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 05:31 AM.
 
Old 02-23-2012, 07:16 AM   #2
cbtshare
Member
 
Registered: Jul 2009
Posts: 569

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

Rep: Reputation: 1988Reputation: 1988Reputation: 1988Reputation: 1988Reputation: 1988Reputation: 1988Reputation: 1988Reputation: 1988Reputation: 1988Reputation: 1988Reputation: 1988
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


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 07:03 AM
How to remove lines and parts of lines from python strings? golmschenk Programming 3 11-27-2009 12:29 AM
Truncate the Lines from the File saurabhchokshi Programming 7 06-16-2009 10:12 AM
Extract lines containing some strings without affectting sequential order cgcamal Programming 7 11-07-2008 12:57 AM
truncate lines with c alaios Programming 17 08-25-2005 09:51 AM


All times are GMT -5. The time now is 10:28 PM.

Main Menu
Advertisement
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