- 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.
- Splunk 7 Essentials(Third Edition)
- 一本書玩轉(zhuǎn)數(shù)據(jù)分析(雙色圖解版)
- 水晶石精粹:3ds max & ZBrush三維數(shù)字靜幀藝術(shù)
- Java Web整合開發(fā)全程指南
- 電腦主板現(xiàn)場維修實錄
- Visual FoxPro數(shù)據(jù)庫基礎(chǔ)及應(yīng)用
- 筆記本電腦維修90個精選實例
- Linux內(nèi)核精析
- Mastering Ceph
- 傳感器與自動檢測
- Photoshop CS4數(shù)碼照片處理入門、進(jìn)階與提高
- PHP求職寶典
- 單片機(jī)C51應(yīng)用技術(shù)
- 網(wǎng)頁設(shè)計與制作
- MySQL Management and Administration with Navicat