Artificial intelligent assistant

grep first n and last n characters from a line in a file I have a log file which looks like: Mar 23 08:20:23 New file got created in sec: 235 Mar 23 08:21:45 New file got created in sec: 127 Mar 23 08:22:34 New file got created in sec: 875 Mar 23 08:25:46 New file got created in sec: 322 Mar 23 08:26:12 New file got created in sec: 639 I need the output to look like: Mar 23 08:20:23 : 235 Mar 23 08:21:45 : 127 Mar 23 08:22:34 : 875 Mar 23 08:25:46 : 322 Mar 23 08:26:12 : 639 What I am able to do is just grep either first part or the last part of the line. I am not able to put the two together. How can I get the desired output from my input?

you can do something like this


awk '{print $1,$2,$3,":",$NF}' logfile

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy 306a6d735ca3f4923acd003cb0a37fd7