On 29Jan2016 19:07, Mike Wright nobody@nospam.hostisimo.com wrote:
Don't know whether this requires a "sed" and/or an "awk" solution. I have strings in a log file whose only important info for a digest are new strings containing the date, time, and the remainder of the line following the first occurrence of a hyphen. All delimiters are spaces until the first hyhpen (there may be multiple hyphens but I only care about the first).
Here is what the original line looks like:
date time txt1 txt2 txt3: txt4 txt5 txt6 txt7 domain-email
Here is what I'm looking for:
date time partFollowingHyphen1
Presuming date and time have no spaces, untested:
sed 's/^([^ ][^ ]* *[^ ][^ ]*) [^-]*-(.*)/\1 \2/'
You'll have to show us an example line if that doesn't work.
Cheers, Cameron Simpson cs@zip.com.au