I'm trying to understand below line of shell code.
grep "^1 " file0 | grep -v MODEL | sed 's/./&E/86' | sed 's/./& /8' | sed 's/./& /20' > file1
Could someone explain what this pipeline does?
# Add "E" after the 86th character
sed 's/./&E/86'
# Add " " after the 8th character
sed 's/./& /8'
# Add " " after the 20th character
sed 's/./& /20'
除了在sed
之前使用多个grep
管道之外,您还可以将它们全部组合成一个sed
表达式
sed '/^1 /{/MODEL/b;s/./&E/86;s/./& /8;s/./& /20}' file0 > file1
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.