Академический Документы
Профессиональный Документы
Культура Документы
For example, to replace all instances of ‘Unix‘ with ‘Linux‘, invoke the
command:
$ man sed
3. Ack Command
Ack is a fast and portable command-line tool written in Perl. Ack is
considered a friendly replacement for grep utility and outputs results in a
visually appealing manner.
Ack command searches the file or directory for the lines that contain the
match for the search criteria. It then highlights the matching string in the lines.
Ack has the capacity to distinguish files based on their file extensions, and to
a certain extent, the content in the files.
Ack command syntax:
In the example below, no file or directory has been provided, but ack has
automatically detected the available file and searched for the matching pattern
provided.
$ ack Linux
4. Awk Command
Awk is a fully-fledged scripting language and also a text processing and data
manipulation tool. It searches files or programs that contain the search
pattern. When the string or pattern is found, awk takes action on the match or
line and prints the results on STDOUT.
The AWK pattern is enclosed between curly braces while the entire program
is enclosed in single quotes.
Let’s take the simplest example. Let’s assume you are printing the date of
your system as shown:
$ date
The command above will display the day of the week and the date of the
month.
Awk Command Examples
To get more options that you can use with awk, simply read our awk
command series.
5. Silver Searcher
The silver searcher is a cross-platform and opensource code searching tool
similar to ack but with an emphasis on speed. It makes it easy for you to
search for a specific string within files in the shortest time possible:
Syntax:
$ ag Linux hello.txt
Find String in File
For additional options, visit the man pages:
$ man ag
6. Ripgrep
Lastly, we have the ripgrep command-line tool. Ripgrep is a cross-platform
utility for searching regex patterns. It’s much faster than all of the earlier-
mentioned search tools and recursively searches directories for matching
patterns. In terms of speed and performance, no other tool stands out
that Ripgrep.
By default, ripgrep will skip binary files/hidden files and directories. Also, be
advised that by default it won’t search for files that are ignored
by .gitignore/.ignore/.rgignore files.
Ripgrep also allows you to search for specific file types. For example, to limit
your search to Javascript files run:
$ rg -Tsj
$ man rg
These are some of the most widely used command-line tools for searching,
filtering, and manipulating text in Linux. If you have other tools you feel we
have left out, do let us know in the comment section.
TagsCommandline Tools, Linux TricksPost navigation
How to Run Any Linux Distribution Directly from Hard Disk in Ubuntu Using
Grub Menu
Useful PuTTY Configuration Tips and Tricks
If you liked this article, then do subscribe to email alerts for Linux tutorials. If
you have any questions or doubts? do ask for help in the comments section.
TecMint is the fastest growing and most trusted community site for
any kind of Linux Articles, Guides and Books on the web. Millions of
people visit TecMint! to search or browse the thousands of
published articles available FREELY to all.
If you like what you are reading, please consider buying us a coffee
( or 2 ) as a token of appreciation.
Related Posts
Learn How to Use Awk Special Patterns ‘BEGIN and END’ – Part 9
Learn How to Use Awk Variables, Numeric Expressions and Assignment
Operators – Part 8
1.
Brandon
August 12, 2020 at 1:23 am
Should probably replace silver searcher with the more modern (and
faster!) RipGrep.
Reply
Ravi Saive
August 12, 2020 at 9:41 am
@Brandon,
Comment
Name EmailWebsite
Save my name, email, and website in this browser for the next time I
comment.
This site uses Akismet to reduce spam. Learn how your comment data is
processed.
Over 3,500,000+ Readers
A Beginners Guide To Learn Linux for Free [with Examples]
Red Hat RHCSA/RHCE 8 Certification Study Guide [eBooks]
Linux Foundation LFCS and LFCE Certification Study Guide [eBooks]
Learn Linux Commands and Tools
10 Practical Examples Using Wildcards to Match Filenames in Linux
4 Ways to Disable/Lock Certain Package Updates Using Yum Command
Install Innotop to Monitor MySQL Server Performance
How to Backup or Clone Linux Partitions Using ‘cat’ Command
11 Linux Kernel Boot-time Parameters Explained
7 Ways to Determine the File System Type in Linux (Ext2, Ext3 or Ext4)
If You Appreciate What We Do Here On TecMint, You Should Consider: