The instructions for HW 02 told you to use a sed command:

sed -e 's/|Open/&\n/g'

This should put a newline after every occurrence of the string |Open. Some older versions of sed don't work this way however. In these versions, instead of a newline, the letter n will be inserted. If this happens to you, change your command to:

sed -e 's/|Open/&\
/g'

Note that I have actually hit the Enter key on my keyboard, which put a newline into the script. This should work on all versions of sed. You can test this by writing:

echo -e 'abcabcabc' | sed 's/c/&\n/g'
echo -e 'abcabcabc' | sed 's/c/&\
/g'

and seeing which of the two works. Both scripts are trying to insert newlines before every a.



blog comments powered by Disqus

Published

18 February 2013

Tags

Subscribe to RSS Feed