Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

This question is for a Unix class, using SSH specifically vi to format the text.

ID: 3604778 • Letter: T

Question

This question is for a Unix class, using SSH specifically vi to format the text. I pasted the contents of the president.txt file below.

Using the presidents.txt file in the class "common" directory (copy it into your own home directory by typing "cp ../common/presidents.txt .") create a script that formats it in the following fashion:

President Vice President(s)
===============================================
<president name> <vice president(s) name>

and then prints the results to a file called "formatted_presidents". Note that you will need to do some "clean up" of the text file to get it to display properly.

Create a directory off of your home directory called "presidents" and place your script file and your resulting formatted file in it. On Blackboard, notify me that you have completed the assignment by stating "Done" in the comments section.

presidents.txt :

George Washington,John Adams

John Adams,Thomas Jefferson

Thomas Jefferson,Aaron Burr,George Clinton

James Madison,George Clinton,Elbridge Gerry

James Monroe,Daniel Tompkins

John Quincy Adams,John C. Calhoun

Andrew Jackson,John C. Calhoun,Martin Van Buren

Martin Van Buren,Richard Mentor Johnson

William H. Harrison,John Tyler

John Tyler,none

James K. Polk,George M. Dallas

Zachary Taylor,Millard Fillmore

Millard Fillmore,none

Franklin Pierce,William R. King

James Buchanan,John C. Breckinridge

Abraham Lincoln,Hannibal Hamlin,Andrew Johnson

Andrew Johnson,none

Ulysses S. Grant,Schuyler Colfax,Henry Wilson

Rutherford B. Hayes,William A. Wheeler

James A. Garfield,Chester A. Arthur

Chester A. Arthur,none

Grover Cleveland,Thomas A. Hendricks

Benjamin Harrison,Levi P. Morton

Grover Cleveland,Adlai Stevenson

William McKinley,Garret Hobart,Theodore Roosevelt

Theodore Roosevelt,Charles W. Fairbanks

William H. Taft,James S. Sherman

Woodrow Wilson,Thomas R. Marshall

Warren G. Harding,Calvin Coolidge

Calvin Coolidge,Charles G. Dawes

Herbert Hoover,Charles Curtis

Franklin D. Roosevelt,John Nance Garner,Henry A. Wallace,Harry S. Truman

Harry S. Truman,Alben W. Barkley

Dwight D. Eisenhower,Richard Nixon

John F. Kennedy,Lyndon B. Johnson

Lyndon B. Johnson,Hubert Humphrey

Richard M. Nixon,Spiro Agnew,Gerald Ford

Gerald R. Ford,Nelson Rockefeller

Jimmy Carter,Walter Mondale

Ronald Reagan,George H.W. Bush

George H. W. Bush,Dan Quayle

Bill Clinton,Al Gore

George W. Bush,Dick Cheney

Barack Hussein Obama,Joe Biden

Donald Trump, Mike Pence

Explanation / Answer

Put this data in file presidents.txt

2.Then put this in another file header.txt

President Vice President(s)
===============================================

then

vim script.sh
which contains

#! /bin/bash -e
cat header.txt
sed 's/,/ /g' presidents.txt


then run the follwing command
bash script.sh > formatted.txt

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote