Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add fgrep to user space #54

Open
rnayakusf opened this issue Sep 8, 2024 · 1 comment
Open

Add fgrep to user space #54

rnayakusf opened this issue Sep 8, 2024 · 1 comment

Comments

@rnayakusf
Copy link

fgrep matches a fixed string against a stream and prints the lines that match. If only given one argument (the fixed string), it matches against standard input. Else, the other arguments are treated as files to match against, and fgrep will prepend the file path (relative to the current directory) and line number.

Alternatively, if the -R flag is passed, the additional arguments are treated as directories and will be recursively searched through for files to match against. Symlinks should be followed.

The -v flag inverts the selection, printing lines that don't match the string.

Libc changes:

  • Add strstr

Future Development:

  • Deal with symlink loops causing infinite recursion.
  • Match against regex (grep).
  • Color
@malensek
Copy link
Contributor

One thing to consider is adding this functionality to the existing grep utility. On many modern systems running fgrep will get translated to grep -F, so perhaps you could add these features to the existing grep. I like the plan to add color, perhaps you could also add an option to print the matching file (since you will support multiple files)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants