A little lost please help me! Thank you all! 6. Consider the file addr below: $
ID: 3736538 • Letter: A
Question
A little lost please help me! Thank you all!
6. Consider the file addr below:
$ cat addr
Xiao Li, lxiao@unc.edu, 6705462234, Jackson, NC 764
Elizi Moe, emoe@ncsu.edu, 5208534566, Tempe, AZ 85282
Ma Ta, mta@yahoo.com, 4345667345, Austin, TX 91030
Diana Cheng, dcheng@asu.edu, 5203456789, Matitsi, WY 4587
Jackson Five, jfive@ncsu.edu, 5206564573, Kyenta, AZ 85483
Adi Srikanth Reddy, sadi1@imap1.asu.edu, 6578904566, Wyo, WS 67854
Natkin William, wnatkin@imap28.asu.edu, 8044344528, Richmond, VA 22345
a. Provide the sed command to Get rid of the lines with private (non “.edu”) email addresses.
Explanation / Answer
Answer: sed 's/.com/.edu/g' addr
Explaination
sed 's/old/new/g' <File Name>
This command uses ’s’ switch to pick search string and ‘g’ switch to conclude the search string.
This command makes no change to original file. However, if you want to make change in file, use ‘-i’ option.
Ex. sed -i 's/old/new/g' <File Name> . This will modify the original file.
Hope it helps.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.