Hello everyone,I need some help over here with grep

i have this

grep -n hello filename 
grep -v hello filename
grep -y hello filename
grep -i hello filename
grep -w hello filename
grep -f file hello filename

and i have to execute these commands with a different way. For instance instead of using grep use sed

for instance i know the answer for the first one.

grep -n hello filename  
sed -nr '/hello/p' filename

and for the second one

grep -v hello filename
sed -nr '/hello/!p' filename

i am not sure for the rest.

Thanks for your help!!

Hello kenshin, how far have you gotten with this? Anything you can do with grep, you can probably do with awk! For example:

grep -y hello filename
# is equal to:
grep -i hello filename
# which is equal to:
awk '/hello/i' filename

Hope this gets you going in the right direction!

-G

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.