2 added 370 characters in body
source | link

You can use grep with PCRE (-P) to extract the desired portion and use it as input for date:

date --date="$(sudo debugfs .... |& grep -Po '^crtime.*-\s\K.*$')" '+%s'

Or

date --date="$(sudo debugfs .... 2>/dev/null | grep -Po '^crtime.*-\s\K.*$')" '+%s'

For example:

$ date --date="$(sudo debugfs -R 'stat <677051>' /dev/sda3 |& grep -Po '^crtime.*-\s\K.*$')" '+%s'
1442488264

You can also use sed:

date --date="$(sudo debugfs .... |& sed -n 's/^crtime.*- \(.*\)$/\1/p')" '+%s'

Or

date --date="$(sudo debugfs .... 2>/dev/null | sed -n 's/^crtime.*- \(.*\)$/\1/p')" '+%s'

For example:

$ date --date="$(sudo debugfs -R 'stat <677051>' /dev/sda3 |& sed -n 's/^crtime.*- \(.*\)$/\1/p')" '+%s'
1442488264

You can use grep with PCRE (-P) to extract the desired portion and use it as input for date:

date --date="$(sudo debugfs .... |& grep -Po '^crtime.*-\s\K.*$')" '+%s'

Or

date --date="$(sudo debugfs .... 2>/dev/null | grep -Po '^crtime.*-\s\K.*$')" '+%s'

For example:

$ date --date="$(sudo debugfs -R 'stat <677051>' /dev/sda3 |& grep -Po '^crtime.*-\s\K.*$')" '+%s'
1442488264

You can use grep with PCRE (-P) to extract the desired portion and use it as input for date:

date --date="$(sudo debugfs .... |& grep -Po '^crtime.*-\s\K.*$')" '+%s'

Or

date --date="$(sudo debugfs .... 2>/dev/null | grep -Po '^crtime.*-\s\K.*$')" '+%s'

For example:

$ date --date="$(sudo debugfs -R 'stat <677051>' /dev/sda3 |& grep -Po '^crtime.*-\s\K.*$')" '+%s'
1442488264

You can also use sed:

date --date="$(sudo debugfs .... |& sed -n 's/^crtime.*- \(.*\)$/\1/p')" '+%s'

Or

date --date="$(sudo debugfs .... 2>/dev/null | sed -n 's/^crtime.*- \(.*\)$/\1/p')" '+%s'

For example:

$ date --date="$(sudo debugfs -R 'stat <677051>' /dev/sda3 |& sed -n 's/^crtime.*- \(.*\)$/\1/p')" '+%s'
1442488264
1
source | link

You can use grep with PCRE (-P) to extract the desired portion and use it as input for date:

date --date="$(sudo debugfs .... |& grep -Po '^crtime.*-\s\K.*$')" '+%s'

Or

date --date="$(sudo debugfs .... 2>/dev/null | grep -Po '^crtime.*-\s\K.*$')" '+%s'

For example:

$ date --date="$(sudo debugfs -R 'stat <677051>' /dev/sda3 |& grep -Po '^crtime.*-\s\K.*$')" '+%s'
1442488264