Posted: . At: 10:16 AM. This was 6 years ago. Post ID: 11982
Page permalink. WordPress uses cookies, or tiny pieces of information stored on your computer, to verify who you are. There are cookies for logged in users and for commenters.
These cookies expire two weeks after they are set.


Some awesome tricks with awk, grep and sed.


Reading a large text file and then finding all words that contain between 5 and 7 vowels. Notice I am not using cat.

jason@Yog-Sothoth:~/Documents$ egrep '^([^aieou]*[aieou]){5,7}[^aieou]*$' < pg768.txt | wc -l
284

Count the number of times a single word appears in a text file.

jason@Yog-Sothoth:~/Documents$ egrep 'Heathcliff' < pg768.txt | wc -l
474

This is how to remove all whitespace from a text file and just print all words jumbled together.

jason@Yog-Sothoth:~/Documents$ tr -dc "[:print:]" < pg768.txt

Generate a long random password with the Linux command line.

http://securitronlinux.com/bejiitaswrath/how-to-generate-a-random-password-using-the-command-line/.

How to use the sed command to filter text files in Linux and other useful shell tricks for the Linux command line.

http://securitronlinux.com/bejiitaswrath/how-to-use-the-sed-command-to-filter-text-files-in-linux-and-other-useful-shell-tricks-for-the-linux-command-line/.

The proper way to use grep without cat. And some nice tricks.

http://securitronlinux.com/debian-testing/the-proper-way-to-use-grep-without-cat-and-some-nice-tricks/.

Another good grep trick to find strings that end in numbers but you are not sure which.

http://securitronlinux.com/bejiitaswrath/another-good-grep-trick-to-find-strings-that-end-in-numbers-but-you-are-not-sure-which/.

How to print information about Linux users with the shell.

http://securitronlinux.com/debian-testing/how-to-print-information-about-linux-users-with-the-shell/.


Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.