Hi i have a log file like example below.
I need only one field from below log [8AC1178C859113944F130797425349430] all other need to be truncated from the log file.
2011-06-13 15:10:53,498 INFO [8AC1178C859113944F130797425349430] [com.tmobile.ei.sbp.cal.logging.LMSHelper] ext.SP->CAL (log point 5)
can any body help on this please.
Thanks
cut -d\[ -f2 <file.log| cut -d \] -f1
OR
awk -F'\[' '{print "["$2}' file.log
Update Doh, Corona's solution below is much neater, though the cut could be updated to
cut -d\ -f4 <file.log
awk '{ print $4; }' < filename
mirni
4
Like this?
sed 's/.* \(\[[^ .]*\]\) .*/\1/' logfile
This will grab the field in brackets with no spaces or dots inside.
This one works like a charm.. is there any output will send to another file.
Thank you very much.
---------- Post updated at 10:52 AM ---------- Previous update was at 10:39 AM ----------
Thanks
I have moved output to file using redirection.... >>