Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我需要修剪文件名的最后 8 个字符 示例:
Input -Vignesh.dat12345678 expected o/p : Vignesh.dat
我尝试使用 rev 但它没有用。
您的问题说您需要删除 5 个字符,而描述说 8 !!!
标准格式-
echo Vignesh.dat12345678 | rev | cut -c X- | rev
假设您要删除 8 个字符,
echo Vignesh.dat12345678 | rev | cut -c 9- | rev
上面的代码将删除最后 8 个字符。要删除n字符,只需放置(n+1)而不是X.
n
(n+1)
X