I'm looking for an awk or sed solution, I'm not a genius with either. I have read all of the suggestions that came up when I started typing this up.
I have a file with lines of data:
name
thisdate=Sep 2 23:59:59 2022 GMT
name
thisdate=Sep 15 23:59:59 2022 GMT
The names and dates/times are all different, the day numbers are always in the same place and always take up the same number of characters (2), the hours/min/secs are all always in the same position on the line and its not every line, thisdate is always a date in the future, and there are no blank lines.
I am trying to remove the time from those date lines by trying to key off thisdate= (that's a space in front of thisdate) and then deleting characters in positions 18-26 (if I counted right)
I've tried a couple things but have been mostly searching for something that fits my needs to point me in the right direction
952 sed 's/^\(.\{18\}\)\(.\{26\}\)/\1/' file <--this may not have worked as I didn't key on a match?
958 sed -i 's/thisdate=(.{11})18/\26/' file
959 sed -i 's/thisdate=(.{10})17/\25/' file
I'm sure I'm missing something but if someone could point me in the right direction I'd be grateful!
GMTpart?