Entries tagged as regular expression

ZSH Gem #23: Working with extended regular expressions

Posted by | Comments (0) | Trackbacks (0)

There are two ZSH modules which allow you to easily work with POSIX extended regular expressions (POSIX ERE) or with Perl compatible regular expressions (PCRE) which are even more advanced than POSIX ERE. These two modules are zsh/regex and zsh/pcre. You can use either one of them or both at the same time. That's entirely up to you. I'll show you both.

Read more…

ZSH Gem #18: Regexp search and replace on parameters

Posted by | Comments (0) | Trackbacks (0)

In ZSH you can easily perform regexp search and replace operations on shell parameters. The only function you need for this is regexp-replace.

Regexp search and replace can be very useful when writing shell scripts which need to process input data, directory names, process trees etc. You assign the string which you need to work on to a parameter and then run the replace function on it.

Read more…

ZSH Gem #2: Extended globbing and expansion

Posted by | Comments (9) | Trackbacks (0)

You are probably familiar with globbing. Globbing is a way to select files on the command line based on a simple pattern. Newer versions of Bash can do a lot more, but I'll show you what the Z Shell can do.

Read more…

Grep's out of date? Full ACK!

Posted by | Comments (2) | Trackbacks (0)

grep is a handy tool and I use it every day. But sometimes I wish it had some more features. For instance full featured Perl compatible regular expressions (PCRE) since the current implementation is not complete and I think it will never be, automatic recursive search, exclusion of non-text files etc.

Here a tool called ack comes into play. It's a search tool and grep replacement written in Perl, which is able to do all these things. Guess what!

Read more…

#24: The awk basics

Posted by | Comments (2) | Trackbacks (2)

awk is very complex and hard to learn. It is the most difficult task in Linux administrator's lives and drives everyone crazy who tries to learn it. It's written by Gods and used by them, no mortal man can ever learn awk.

In fact…, no! If you know any C-like programming language and regular expressions, awk is absolutely easy and it can make things much easier. It's pretty mighty, but I've never seen any programming language easier than awk (except QBasic).

Read more…

#20: Multi-line sed search and replace

Posted by | Comments (6) | Trackbacks (2)

sed is built to process strings (either from STDIN or from a file) line by line. Therefore, you can't search for multiple lines. But there are several ways to work around this. I'll be showing you three ways of performing multi-line replacements.

Read more…

#8: Advanced usage of grep

Posted by | Comments (6) | Trackbacks (2)

grep is probably one of the best known, or let's better say: the most used command line tools on UNIX systems. But not many people know that it is so much more than just a very simple text search command.

Read more…

(Page 1 of 1, totaling 7 entries)
Design and Code Copyright © 2010-2014 Janek Bevendorff Content on this site is published under the terms of the GNU Free Documentation License (GFDL). You may redistribute content only in compliance with these terms. tweetbackcheck