Quiero ver el
diff between a paragraph in the middle of a file and a file containing a single paragraph.
The paragraph is on line
60 de archivo
bar contains only that paragraph with possible minor differences.
I can extract that paragraph using
sed -n 60,60p foo. How can I use this in
Las siguientes no trabajo:
sed -n 60,60p foo | diff bar # diff: missing operand after `foo` diff bar `sed -n 60,60p foo` # diff: extra operand `in`
sed -n 60,60p foo >> tempfile; diff bar tempfile
Is there a solution that doesn't require me to store somewhere temporarily using a pipe?
preguntado el 27 de agosto de 12 a las 07:08
If you use a '-' as file argument,
diff will read from stdin:
sed -n 60,60p foo | diff bar -
You could use process substitution:
diff bar <(sed -n 60,60p foo)
This can also be used to compare the output from two processes:
diff <(sed -n 60,60p bar) <(sed -n 60,60p foo)