Note that if you keep coming to us with requests for us to write code for you with you not attempting to write any code on your own, we're likely to lose interest in helping you. We are here to help you learn how to do this stuff on your own; not to act as your unpaid programming staff.
I would be tempted to try something like:
#!/bin/ksh
awk '
/^create / {
c = $0
}
/^from .*@/ {
print c
print
}' "$@"
Store the above in a file named whatever you want your utility to be named and make it executable in a directory in your search path (i.e. one of the directories named in the environment variable PATH ).
If you name your utility scriptname , you can then invoke it any of the following forms:
where pathname... can be replaced with the pathname(s) of one or more files you want to process. (Note that there is no ... in the last form (and only one pathname can be processed using that form).
I can put thousands of lines on my suggestion. Is there something in particular that you want the line that you put on my suggestion to do? Or should I just make something up for the fun of it? My crystal ball is a bit cloudy today and I'm not getting a clear view of what you might want it to do.
Wow! That wasn't at all what I was expecting. From your sample data, I thought you were looking for lowercase words create and from at the start of a line of input. But instead you are looking for an uppercase CREATE followed by a <space> anywhere on a line and are looking for any of the characters f , F , m , M , o , O , r , R , or | followed by a <space> followed by any number of characters that includes an @ .
What output would you hope to get from the input file:
reCREATE xyzzy
| @
f @
O x@y
r v@w
from: a@b
Does it surprise you that the only line in the above sample that is not printed at least once by your code is the last line? Is that what you want your code to do?