Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

using sed Consider the following file called swap.txt : 349 230 481 800 456 129 043 942 584 901 627 874 Each three-digit number is

using sed

Consider the following file called swap.txt:

349 230 481

800 456 129

043 942 584

901 627 874

Each three-digit number is separated by a space. Write a one-line sed command that performs in-place substitution to swap the first digit with the third digit of the first number in every line. For example, after running the appropriate sed command, the swap.txt file would contain:

943 230 481

008 456 129

340 942 584

109 627 874

For bonus, can you swap the first digit with the third digit of the second number in every line? Do not worry about performing in-place substitution for this part. For example, after running the appropriate sed command, the following would be output to the terminal:

349 032 481

800 654 129

043 249 584

901 726 874

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Practical Azure SQL Database For Modern Developers Building Applications In The Microsoft Cloud

Authors: Davide Mauri, Silvano Coriani, Anna Hoffma, Sanjay Mishra, Jovan Popovic

1st Edition

1484263693, 978-1484263693

More Books

Students also viewed these Databases questions

Question

Explain the concept of shear force and bending moment in beams.

Answered: 1 week ago

Question

What is the Definition for Third Normal Form?

Answered: 1 week ago

Question

Provide two examples of a One-To-Many relationship.

Answered: 1 week ago