Question: sed is a stream editor that enables you to work on specific lines in a file and modify their contents. In this project, you use

sed is a stream editor that enables you to work on specific lines in a file and modify their contents. In this project, you use sed to display specific lines and edit a file that you create. The focus of this project is on using sed commands from the command line. To use sed to manipulate a file: 1. Create the new file, unix_stuff, in your working directory by using the vi or Emacs editor. The unix_stuff file should contain the following lines (press Enter after typing each lineexcluding after the final lineto have five lines of text): Although UNIX supports other database systems, UNIX has never abandoned the idea of working with flat files. Flat files are those that are based on pure text with standard ASCII codes. Flat files can be read by any operating system. 2. To display only lines 3 and 4, type sed -n 3,4p unix_stuff, and press Enter. (The -n option prevents sed from displaying any lines except those specified with the p command.) This means find lines numbered (-n) 3 and 4 in the file unix_stuff and display them (p). You see lines 3 and 4: flat files. Flat files are those that are based on pure text with standard ASCII codes. Flat files 3. In sed, you can place two commands on one line. If you want to delete lines 3 and 4 and then display the file, you must use the -e option to specify multiple commands on the same line. To delete lines 3 and 4 from unix_stuff and display the results, type sed -n -e 3,4d -e p unix_stuff, and press Enter. You see this text: Although UNIX supports other database systems, UNIX has never abandoned the idea of working with can be read by any operating system. Lines 3 and 4 are not actually deleted from the file, but simply filtered out so that they are not displayed on the output to the screen. 4. To display only lines containing the word Flat, type sed -n /Flat/p unix_stuff, and press Enter. You see this text: flat files. Flat files are those that are based on pure text with standard ASCII codes. Flat files 5. To replace all instances of the word Flat with Text, type sed -n s/Flat/Text/p unix_stuff, and press Enter. (Be certain that you capitalize the words Flat and Text.) The s command substitutes one string of characters for another.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!