In: Computer Science
linux
Using the grep or egrep commands, what would be the full command (including regular expression) to view only the lines in the file /boot/grub/grub.cfg that DO NOT begin with a hashtag (the # sign). In other words, what would be the command to print all the lines in this file that do not begin with this character.
Grep command in Unix/Linux is the short form of ‘global search for the regular expression’.
The grep command is a filter that is used to search for lines matching a specified pattern and print the matching lines to standard output.
Grep Regular Expression. A regular expression or regex is a pattern that matches a set of strings
Command:
grep "^[^#;]" /boot/grub/grub.cfg
Original Grub File with Hashes
If you have any doubts, leave a comment below before rating. I'll be happy to assist you further.
Do UPVOTE this as I have put a lot of EFFORT in answering this question. It really helps me.