[英]Delete the first five characters on any line of a text file in Linux with sed
I need a one-liner to remove the first five characters on any line of a text file. 我需要一个单行删除文本文件的任何行上的前五个字符。 How can I do that with sed?
我怎么能用sed做到这一点?
sed 's/^.....//'
means 手段
replace ("s", substitute) beginning-of-line then 5 characters (".") with nothing . 替换(“s”,替换)行首,然后替换5个字符(“。”) 。
There are more compact or flexible ways to write this using sed or cut. 使用sed或cut有更紧凑或灵活的方法来编写它。
sed 's/^.\{,5\}//' file.dat
awk '{print substr($0,6)}' file
sed 's/^.\\{,5\\}//' file.dat
对我来说就像一个魅力
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.