Please use ***[code][/code]
*** tags around your code and data, to preserve the original formatting and to improve readability. Do not
use quote tags, bolding, colors, "start/end" lines, or other creative techniques.
expression should be fine. If you would post the actual command you used and what you actually got in return instead of just saying "it didn't work", we might be able to figure out why.
In any case, one big problem you have is the first part of your command chain:
grep -k2 |sed 's/m/male/g' famous.data
can take input from either a file, or from a pipe, but not both at once. And your grep
command doesn't have any input, nor does it have a "-k
" option. Could you explain what you're trying to do here? I imagine the rest of it will work if you leave the grep out.
Finally, since your assignment says to use two sed commands you have to do it that way, but actually the whole thing, including the function of head
, can be completed with a single, relatively easy sed
command (a single two-part address and two sub-expressions).
I'll leave it up to you to figure out the details.
Here are a few useful sed references: