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)?

hek2mgl
  • 133,888
  • 21
  • 210
  • 235
user2490373
  • 143
  • 1
  • 2
  • 9

3 Answers3

3

You can pipe the output to sed:

... | sed 's/.*Rev\.\([0-9]*\).*/\1/'
hek2mgl
  • 133,888
  • 21
  • 210
  • 235
2

You can pipe the output with:

awk -F '[./]+' '{print $4}'
anubhava
  • 664,788
  • 59
  • 469
  • 547
1

U can use grep also

... | grep -o Rev.[0-9]* s | grep -o [0-9]*
Sakthi Kumar
  • 2,967
  • 13
  • 27