UNIX Assignment 1. List 4 functions of the sed editor? 2. True or False: The pos
ID: 3596853 • Letter: U
Question
UNIX Assignment
1. List 4 functions of the sed editor?
2. True or False: The positional parameters $0, $1, etc. have the very similar meaning when used with a gawk editior. Explain.
3. List the different special characters within POSIX BRE Regular Expression engine.
4. Using the sed editor show two (2) different command line arguments that would read data from a file myfile.txt and insert after the second line of text in mydata.txt.
myfile.txt
First new line
Second new line
mydata.txt
Line number 1
Line number 2
Line number 3
Line number 4
For questions 5-8 use the attached file (data.txt) as the input file. For each question submit the sed command used and the resulting output. Note: Start with a fresh copy of data.txt for each question.
Explanation / Answer
1.The 4 Functions of sed editor are:
Syntax to insert text in a file - $sed `<Line Number>i <Text1> <Text2> ...` <Input File> [> <Temporary File>]
Syntax to copy the contents of the file to another file - $sed ` /<Search Pattern>/w <New File>` <Input File>
Syntax to find and replace a particular pattern in a file - $sed `s /<Find Pattern>/<Replace String>/` <Input File>
Syntax to delete lines in a file - $sed `/<Search Pattern>/ d' <Input File> [> <Temporary File>]
2.True. As Positional Parameters can be used in awk programming and gawk is GNU awk which is an implementation of awk programming.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.