#๐ Need help coding my first grep
40 messages ยท Page 1 of 1 (latest)
@high walrus
Remember to:
- Ask your Python question, not if you can ask or if there's an expert who can help.
- Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
- Explain what you expect to happen and what actually happens.
:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.
Searches for patterns in files
Or just searches for patterns in general
ok, so let's break down some of the pieces of what it has to do.
first it needs to be told what to look for, how does that happen?
it recieves an input from the user
how? Be specific.
can i tell you using what knowledge i have of the re library?
sure, but we're not at re yet, you said it needs to get input from the user.
okay so
the user tells the grep command what to search through, then it recieves an input of what to search, through a function
let's be very specific about the actual UI of this program. What does it look like when a user uses it?
its a command line
ok, and the pattern to search for is specified on the command line.
do you know how to read things from the command line?
what do you mean?
can you write a grep that simply prints out, You asked me to search for 'hello'?
forget grep. Write a program called xyz. When you run xyz hello, it prints You asked me to search for 'hello'
okay ill do it quickly
wait: we were making a list of things it needs to do.
the first thing is, get the pattern from the command line.
findstr?
you use it to search text files on windows
okay thanks for the help :)
you are looking in the wrong places.
who told you to write grep? How are you learning to program?
This help channel has been closed. Feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.