Quantcast
Channel: Active questions tagged bash+awk - Ask Ubuntu
Viewing all articles
Browse latest Browse all 102

How to use grep to match a string with spaces in it?

$
0
0

Can anyone help me with this:

I am trying to extract a time stamp, by matching a string. For this am using combination of grep/awk commands. As the sting has 4 spces before [1] and one after, am confused how to work around it. Am new to programming, so need some help here.

IS="$(grep 'Starting    [1] TaskInit' process.log |  awk '{print $4}')"
echo "$IS"

Aim: It should match the string in the process.log file and should print out the time stamp related to that row.


Viewing all articles
Browse latest Browse all 102

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>