Text Manipulation and Filters Requirements

Purpose: Text Manipulation and Filters Requirements: Read the documentation carefully before proceeding. Objectives:

  • Students should be able to use Pipes to execute Linux commands.
  • Apply filters to solve the student management problem. Content:
  • Students login with their registered user. Note: Do not login as root user for this task. Compose a text using vi: Use vi to compose a file named "baitho.txt". [sinhvien@LinuxServer ~]$ vi baitho.txt ↵ Press 'i' key to enter content into the file (compose a poem as desired) ⮚ Save the file and exit vi: o Press ESC o Type :wq! ↵ (Note: Press ESC 🡪 Type : 🡪 Type w 🡪 Type q 🡪 Type ! 🡪 Press ENTER)

Question 1. Use the vi editor to create a text file "kehoach.dat" and perform the following operations:
1.Switch to command mode and display line numbers in the file. : set number ⮠ : set nu ⮠
2.Delete line 13.
3.Copy line 3 and paste it at the end of the document.
4.Undo the paste operation. Observe the deleted line when you undo.
5.Search and replace:
:1, $s/[old]/[new]/ or :s/text1/text2/g
6.Save the file and exit vi:
:wq! ⮠ :x ⮠

Question 2. Suppose in Binh's directory, there is a file "Message.txt" containing information related to Binh. Perform the following steps:
1.List all lines containing the word "Binh" in the file.
2.Count the number of lines, words, and characters in the "messages" file containing the word "Binh."

Question 3. Given a database file of books, each record in this file contains: Book code, Book name, Author Name, Publisher name, and Price.

  • Requirements:
    1.Add these records to the database.
    2.Filter and display books by Chris Donaldson.
    3.Filter and display books with a price of 400.
    4.Filter and display programming books, showing only the book name and author. 5.Sort the file based on the Book code field and display book information.
    6.Sort the file based on the Price field and display the corresponding book name and author.
    7.Display records of books priced from 300 to 499.
    8.Change the book name and author to uppercase and display the number of books written by Steve Irving.
    9.How many books are there currently?

@luanjjjh , welcome.

Your post looks like a copy/paste of class/course assignments (advise if otherwise).
What specifically do you want help with , some/any/all ?
We are not here to do your work for you, the forum is a collaboration , you supply details about specific challenges you face - supply your attempt(s) at those and we provide guidance (that may include code) to help you get a working solution.

regards

PS: if you have classmates/work colleagues doing same/similar, reach out to them first, having teammates to help bounce ideas off/share problems with will go a long way to helping you face challenges with confidence.

3 Likes