[1] Starting from line 3000, display 1000 lines. That is, rows 3000~3999
are displayedcat filename | tail -n 3000 | head -n 1000
【二】Display lines 1000 to 3000
cat filename| head -n 3000 | tail -n 1000
*Note the order of the two methods
break down:
tail -n 1000: Display the last 1000 lines
tail -n 1000: Start displaying from line 1000, and display
after line 1000
Head -n 1000: Display the first 1000 lines
【三】Use sed command
sed -n '5,10p' filename This way you can only view lines 5 to 10 of the file.
Linux statistics file line number
Syntax: wc [options] file...
Description: This command counts the number of bytes, words, and lines in a given file. If no filename is given, then standard input is read. wc also gives a total count of all specified files. Words are the largest string of characters separated by space characters.
The meaning of each option of this command is as follows:
-c counts the number of bytes.
- l counts the number of rows.
- w counts the number of words.
These options can be used in combination.
The order and number of output columns are not affected by the order and number of options.
Always displayed in the following order and with a maximum of one column per item.
Number of lines, number of words, number of bytes, file name
If there is no filename on the command line, the filename does not appear in the output.
For example:
$ wc - lcw file1 file2
4 33 file1
7 52 file2
11 11 85 total
Example analysis:
1. Statistics of the number of js files in the demo directory:
find demo/ -name "*.js" |wc -l
2. Count the code lines of all js files in the demo directory:
find demo/ -name "*.js" |xargs cat|wc -l or wc -l `find ./ -name "*.js"`|tail -n1
3. Count the code lines of all js files in the demo directory, and filter out empty lines:
find /demo -name "*.js" |xargs cat|grep -v ^$|wc -l
The above is the detailed content of Use command to view partial lines of log file in Linux. For more information, please follow other related articles on the PHP Chinese website!

Linux performs well in servers and development environments, while Windows performs better in desktop and gaming. 1) Linux's file system performs well when dealing with large numbers of small files. 2) Linux performs excellently in high concurrency and high throughput network scenarios. 3) Linux memory management has more advantages in server environments. 4) Linux is efficient when executing command line and script tasks, while Windows performs better on graphical interfaces and multimedia applications.

Creating graphical user interface (GUI) applications is a fantastic way to bring your ideas to life and make your programs more user-friendly. PyGObject is a Python library that allows developers to create GUI applications on Linux desktops using the

Arch Linux provides a flexible cutting-edge system environment and is a powerfully suited solution for developing web applications on small non-critical systems because is a completely open source and provides the latest up-to-date releases on kernel

Due to its Rolling Release model which embraces cutting-edge software Arch Linux was not designed and developed to run as a server to provide reliable network services because it requires extra time for maintenance, constant upgrades, and sensible fi
![12 Must-Have Linux Console [Terminal] File Managers](https://img.php.cn/upload/article/001/242/473/174710245395762.png?x-oss-process=image/resize,p_40)
Linux console file managers can be very helpful in day-to-day tasks, when managing files on a local machine, or when connected to a remote one. The visual console representation of the directory helps us quickly perform file/folder operations and sav

qBittorrent is a popular open-source BitTorrent client that allows users to download and share files over the internet. The latest version, qBittorrent 5.0, was released recently and comes packed with new features and improvements. This article will

The previous Arch Linux LEMP article just covered basic stuff, from installing network services (Nginx, PHP, MySQL, and PhpMyAdmin) and configuring minimal security required for MySQL server and PhpMyadmin. This topic is strictly related to the forme

Zenity is a tool that allows you to create graphical dialog boxes in Linux using the command line. It uses GTK , a toolkit for creating graphical user interfaces (GUIs), making it easy to add visual elements to your scripts. Zenity can be extremely u


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

SublimeText3 Chinese version
Chinese version, very easy to use

WebStorm Mac version
Useful JavaScript development tools

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver Mac version
Visual web development tools
