How can I copy the description of cat command from the manual to the file named cat-man? I have tried to the synopsis of cat command while it is always with a error that no file name cat-man or destination.
closed as unclear what you're asking by slm♦, Anthon, jasonwryan, rahmu, Shadur Nov 9 '13 at 14:01
Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.
$ man cat > cat-man
> allows you to redirect
stdout to a file name. In this case a file called: cat-man.
One way could be:
sed '/^DESCRIPTION$/,/^[^ ]/!d' <(man cat) | head -n -1 > cat-man
Note that negative value for
head is non POSIX.