Linux command Line troubleshooting
Hi there
I'm new to this forum: I was wondering if someone could help me figure out a task In the second field, change 'f' to female and 'm' to male globally. Display the first 9 lines. Use 2 sed statements one piped to another. Note use of single quotes in examples. This was my output [sjim7@hills ~]$ grep -k2 |sed 's/m/male/g' famous.data | sed 's/f/female/g' | head -n 9 grep: invalid option -- 'k' Usage: grep [OPTION]... PATTERN [FILE]... Try `grep --help' for more information. 01 male maleotzart amaleadeous 25 2nd 94233 02 male guthrie woody 23 2nd 94223 03 female simaleone nina 27 2nd 94112 04 male lennon john 29 2nd 94221 05 female harris emalemaleylou 20 2nd 94222 06 male malearley bob 22 2nd 94112 07 female malearley rita 26 2nd 94212 08 female warwick dione 26 2nd 94222 09 male prine john 35 3rd 94321 How would i type it to focus on the second column to change the m to males, and f to females , instead of changing every letter in each column that has a m to male , thanks |
|
Please post your thread in only one forum. Posting a single thread in the most relevant forum will make it easier for members to help you and will keep the discussion in one place. This thread is being closed because it is a duplicate.
|
All times are GMT -5. The time now is 04:56 AM. |