Skip to main content
added 2 characters in body
Source Link
RudiC
  • 9.1k
  • 2
  • 12
  • 22

Your date command seems to allow for the -d-d option to convey a date/time. Try like

cut -d' ' -f-2 file | date +%s -f- | paste -d' ' - file | cut -d' ' -f1,4- 1644502514 lorem 1644502515 ipsum 1644502516 dolor 

It cuts the date/time fields from the input, feeds them to the date command via the -f (read DATEFILE) option, pastes it back to the input file, and cuts out the old date/time fields.

Your date command seems to allow for the -d option to convey a date/time. Try like

cut -d' ' -f-2 file | date +%s -f- | paste -d' ' - file | cut -d' ' -f1,4- 1644502514 lorem 1644502515 ipsum 1644502516 dolor 

It cuts the date/time fields from the input, feeds them to the date command via the -f (read DATEFILE) option, pastes it back to the input file, and cuts out the old date/time fields.

Your date command seems to allow for the -d option to convey a date/time. Try like

cut -d' ' -f-2 file | date +%s -f- | paste -d' ' - file | cut -d' ' -f1,4- 1644502514 lorem 1644502515 ipsum 1644502516 dolor 

It cuts the date/time fields from the input, feeds them to the date command via the -f (read DATEFILE) option, pastes it back to the input file, and cuts out the old date/time fields.

Source Link
RudiC
  • 9.1k
  • 2
  • 12
  • 22

Your date command seems to allow for the -d option to convey a date/time. Try like

cut -d' ' -f-2 file | date +%s -f- | paste -d' ' - file | cut -d' ' -f1,4- 1644502514 lorem 1644502515 ipsum 1644502516 dolor 

It cuts the date/time fields from the input, feeds them to the date command via the -f (read DATEFILE) option, pastes it back to the input file, and cuts out the old date/time fields.