- Learning Linux Shell Scripting
- Ganesh Naik
- 300字
- 2021-06-25 22:02:49
Text filtering tools
Normally, shell scripting involves report generation, which will include processing various text files and filtering their output to finally produce the desired results. Let's start discussing the two Linux commands, namely more and less:
- more: Sometimes we get a very large output on the screen for certain commands, which cannot be viewed completely in one screen. In such cases, we can use the more command to view the output text one page at a time. Add | more after the command, as follows:
$ ll /dev | more
The | is called a pipe. You will learn more about it in the next chapters. In this command, pressing the spacebar will move the output on the screen one page at a time, or pressing Enter will move the screen one line at a time.
- less: Instead of more, if you use less, it will show a screen containing the full text all at once. We can move forward as well as backward. This is a very useful text-filtering tool.
The syntax usage is as follows:
$ command | less e.g. $ ll /proc | less
This command will show a long directory listing of the /proc folder. Let's say that we want to see whether the cpuinfo file is present in the directory. Just press the arrow key up or down to scroll through the display. With the more command, you cannot scroll backward. You can move forward only. With page up and down key presses, you can move forward or backward one page at a time, which is very fast. In addition to scrolling forward or backward, you can search for a pattern using /for forward search and ? for backward search. You can use N for repeating the search in a forward or backward direction.
- 大數(shù)據(jù)戰(zhàn)爭(zhēng):人工智能時(shí)代不能不說(shuō)的事
- 精通MATLAB神經(jīng)網(wǎng)絡(luò)
- 網(wǎng)上生活必備
- VMware Performance and Capacity Management(Second Edition)
- ROS機(jī)器人編程與SLAM算法解析指南
- Pig Design Patterns
- 21天學(xué)通Visual Basic
- 大學(xué)計(jì)算機(jī)應(yīng)用基礎(chǔ)
- Implementing Splunk 7(Third Edition)
- 大學(xué)C/C++語(yǔ)言程序設(shè)計(jì)基礎(chǔ)
- 21天學(xué)通C語(yǔ)言
- Visual Basic.NET程序設(shè)計(jì)
- Mastering pfSense
- ESP8266 Robotics Projects
- AI的25種可能