Reputation: 547
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?
Upvotes: 0
Views: 480
Reputation: 123608
Instead of using multiple grep
pipelines before sed
, you could combine it all into one sed
expression
sed '/^1 /{/MODEL/b;s/./&E/86;s/./& /8;s/./& /20}' file0 > file1
Upvotes: 6
Reputation: 1
# 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'
Upvotes: 7