Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


Closed Thread
  Search this Thread
Old 10-11-2012, 12:26 AM   #1
LQ Newbie
Registered: Oct 2012
Posts: 7

Rep: Reputation: Disabled
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' | 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
Old 10-11-2012, 12:54 AM   #2
LQ Guru
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 9,565

Rep: Reputation: 2811Reputation: 2811Reputation: 2811Reputation: 2811Reputation: 2811Reputation: 2811Reputation: 2811Reputation: 2811Reputation: 2811Reputation: 2811Reputation: 2811
duplicate of
Old 10-11-2012, 12:42 PM   #3
LQ Guru
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978
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.

Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Cursor does not move to the bottom line and overwrite to same line on command line mesuutt Linux - Newbie 3 02-25-2012 08:04 AM
troubleshooting methods of failed command frznchckn Linux - Software 1 10-18-2010 11:44 AM
LXer: The Linux Command Shell For Beginners: Fear Not The Command Line! LXer Syndicated Linux News 0 12-22-2008 06:30 PM
xine command line? or some other command line only engine? lumix Linux - Software 2 08-10-2007 10:46 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:58 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration