I need to trim last 8 character of a file name
Example:
Input -Vignesh.dat12345678
expected o/p : Vignesh.dat
I tried using rev but it didn't worked.
Your question says that you need to remove 5 characters, while the description says 8 !!!
Standard Format-
echo Vignesh.dat12345678 | rev | cut -c X- | rev
Assuming you want to remove 8 characters,
echo Vignesh.dat12345678 | rev | cut -c 9- | rev
The above code will remove last 8 characters. To remove n
characters, simply put (n+1)
instead of X
.