by attaching it here?
don't know how to get a copy tom.c to you.
use | for or, what do you use for and??
foo | grep 'firstExpression' | grep 'secondExpression'
foo | grep -n '(firstExpression.*secondExpression|secondExpression.*firstExpression)'
Attach tom.c (as aragats requested) and tell what you would like to have matched.grep -n '\\' tom.c works and grep -n 'stdio' tom.c works. Can I combine these two grep statements into one grep statement. I tried various ,* combinations
When writing a message click on the "Attach files" button (with the paperclip in front of it) at the bottom of your message.don't know how to get a copy tom.c to you.
Works here with "or":grep -n '\\' tom.c works and grep -n 'stdio' tom.c works.
Can I combine these two grep statements into one grep statement. I tried various ,* combinations, The computer didn't complain but it didn't offer any output either.
....
i attached tom.txt
% grep '\\\|stdio' tom.c
#include<stdio.h>
printf("%f\n",func(10.0));
% grep -E '\\|stdio' tom.c
#include<stdio.h>
printf("%f\n",func(10.0));
thanks.chief allready gave the answer.
What was very helpful to me:
If you're going to create & practice more with rugular expressions, 1-3 sort of go together. If your shell is sh(1) or you choose to script in sh(1), then that one will be practical too.
- Regular Expressions
- UNIX SHELL Quote Tutorial
- Sed - An Introduction and Tutorial by Bruce Barnett
- Sh - the POSIX Shell
Getting confident with regular expression can take some time; I'm still learning.