Today I was trying to treat an SVN dump file with sed
in order to modify a few of the Node-path
values. After finding out that GNU sed has no problem with binary files, I went on to formulate the problem … first on the command line:
sed '/^Node-/s/match/replacement/p' inputfile
The intent should be clear: testing my expressions, i.e. for lines that start with “Node-” replace match
with replacement
and print it out. From that, however, I got my terminal all garbled since it printed some control characters. Only after re-reading the respective part in the “sed & awk” book from O’Reilly I noticed that it should have been:
sed -n '/^Node-/s/match/replacement/p' inputfile
This way only lines that I tell it to print will make it to the terminal and nothing go garbled anymore.
// Oliver