3

I run the next:

 find . -type f -printf '%T@ %p\n' | sort -n | tail -1

this return me the next:

1376221215.000000000 ./Rev.12345/run.exe

I want to get only the 12345 number. Which command I should use (I try to use cut command, without success)?

4

3 回答 3

3

您可以将输出通过管道传输到sed

... | sed 's/.*Rev\.\([0-9]*\).*/\1/'
于 2013-08-11T09:26:15.290 回答
2

您可以使用管道输出:

awk -F '[./]+' '{print $4}'
于 2013-08-11T09:26:56.777 回答
1

你也可以使用grep

... | grep -o Rev.[0-9]* s | grep -o [0-9]*
于 2013-08-11T09:28:44.350 回答