How to remove all words from a matching word in a line?

Hi Guys, :stuck_out_tongue:

I have a file like this:

2010-04-25 00:00:30,095 [ExecuteThread: '191' for queue: 'weblogic.kernel.Default']  INFO - [123456789]]- start process U100M4
2010-04-25 00:00:30,096 [ExecuteThread: '191' for queue: 'weblogic.kernel.Default'] DEBUG - [123456789]] -- call EJB
2010-04-25 00:00:30,709 [ExecuteThread: '191' for queue: 'weblogic.kernel.Default']  INFO - [123456789]- end processU100M4
2010-04-25 00:00:30,710 [ExecuteThread: '191' for queue: 'weblogic.kernel.Default'] DEBUG - got message=Sorry

I want to out put format.

2010-04-25 00:00:30 INFO - [123456789]]- start process U100M4
2010-04-25 00:00:30 DEBUG - [123456789]] -- call EJB
2010-04-25 00:00:30  INFO - [123456789]- end processU100M4
2010-04-25 00:00:30 DEBUG - got message=Sorry

How do I do this?

Thanks. :smiley:

Try this...

sed "s/\[ExecuteThread: '191' for queue: 'weblogic.kernel.Default'\]//" infile

try out this

kamaraj@kamaraj-laptop:~/Desktop/testing$ cat unix_thread.txt  | awk '{printf ("%s %0.8s %s %s %s %s %s %s\n",$1,$2,$8,$9,$10,$11,$12,$13)}'
2010-04-25 00:00:30 INFO - [123456789]]- start process U100M4
2010-04-25 00:00:30 DEBUG - [123456789]] -- call EJB
2010-04-25 00:00:30 INFO - [123456789]- end processU100M4 
2010-04-25 00:00:30 DEBUG - got message=Sorry  

---------- Post updated at 12:20 PM ---------- Previous update was at 12:17 PM ----------

small correction in the malcomex post

kamaraj@kamaraj-laptop:~/Desktop/testing$ sed "s/.....\[ExecuteThread: '191' for queue: 'weblogic.kernel.Default'\]//" unix_thread.txt 
2010-04-25 00:00:30  INFO - [123456789]]- start process U100M4
2010-04-25 00:00:30 DEBUG - [123456789]] -- call EJB
2010-04-25 00:00:30  INFO - [123456789]- end processU100M4
2010-04-25 00:00:30 DEBUG - got message=Sorry

Is the text to delete always begins with "," and ends with "fault']" then try with:

sed 's/,.*t.]//g' file

Hope it helps.

Regards,

Or:

sed 's/,[^]]*]//' infile
cut -c-19,84- infile

thank all ^ ^