LINUX LITE 7.2 FINAL RELEASED - SEE RELEASE ANNOUNCEMENTS SECTION FOR DETAILS


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
grep - search for an "option" - text itself is a valid command parameter [solved
#1
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:
man rsync | grep '--prune' -A1 -B4'
Problem is I get error grep: unrecognized option '--prune'.[size=1em]How can I make grep to recognise the text pattern "--prune" as the pattern to search for?[/size][size=1em]I can remove the two dashes, but that is not what I want to do.[/size][size=1.45em][edit while write post][/size]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:
man rsync | grep '\-\-prune' -A1 -B4
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 Smile
Reply


Messages In This Thread
grep - search for an "option" - text itself is a valid command parameter [solved - by Sprintrdriver - 08-09-2018, 06:36 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)