You are Here:
Linux Lite 6.6 FINAL Released - Support for 22 Languages Added - See Release Announcement Section



grep - search for an "option" - text itself is a valid command parameter [solved

Author (Read 4355 times)

0 Members and 1 Guest are viewing this topic.

 

kpanic

  • PayPal Supporter
  • Forum Regular
  • *****
  • 162
    Posts
  • Reputation: 67
  • Linux Lite Member
    • View Profile

  • CPU: Core i5 M450

  • MEMORY: 8Gb

  • VIDEO CARD: Nvidia GT216
Use double quotes: man rsync | grep "\-\-prune" -A1 -B4

Please set the topic as solved even if you found the solution yourself. It saves time from the rest of us.
Thanks!

« Last Edit: August 29, 2018, 05:09:14 PM by kpanic »
 

 

Sprintrdriver

  • Forum Regular
  • ***
  • 110
    Posts
  • Reputation: 6
  • Linux Lite on Dell Lattude D620
    • View Profile

  • CPU: Intel Core2 T5500

  • MEMORY: 3Gb

  • VIDEO CARD: Intel Mobile 945GM/GMS 943/940GML Express
Hi folks. Have som beginner-issues using grep here.
I'm up to search for the term "--prune-empty-dirs" in the man page of rsync. So I tried to ran this command:
Code: [Select]
man rsync | grep '--prune' -A1 -B4'Problem is I get error grep: unrecognized option '--prune'.How can I make grep to recognise the text pattern "--prune" as the pattern to search for?I can remove the two dashes, but that is not what I want to do.[edit while write post]Ok, I found the solution after I remembered to search the web for "grep escape character" (that is probably what I should had ask for) - so I got it to work with the same command, but backslashes in front of all dashes:
Code: [Select]
man rsync | grep '\-\-prune' -A1 -B4
« Last Edit: August 29, 2018, 05:28:04 PM by Sprintrdriver »
I won't let an old, but fully functional computer die just because some company tell me that they won't make no more security updates to their OS. Thanks Linux :)
 

 

-->
X Close Ad

Linux Lite 6.6 FINAL Released - Support for 22 Languages Added - See Release Announcement Section