1

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.

  • 3
    Are you trying to cat the contents of a man page to a file? It's unclear what you're asking about. Showing the command you're trying to run would definitely help. – slm Nov 9 '13 at 5:12
  • concur with @slm; please reword this if you'd like the question to remain open. – Shadur Nov 9 '13 at 14:01
2

Use:

$ man cat > cat-man

The > allows you to redirect stdout to a file name. In this case a file called: cat-man.

2

One way could be:

sed '/^DESCRIPTION$/,/^[^ ]/!d' <(man cat) | head -n -1 > cat-man

Note that negative value for head is non POSIX.

Not the answer you're looking for? Browse other questions tagged or ask your own question.