Shadow

Tag: UNIX Commands

Sort

Recent Posts, Blog, Linux
The command sort is used to sort files line by line.  Lines starting with a number go first. Lines that come next in order go alphabetical with uppercase letters appearing before lowercase ones. Use cat to create "testsort" for the example. ~/Test>cat testsort A line 1 a line 2 8 line 3 line 4 5 line 5 ~/Test>sort testsort 5 line 5 8 line 3 A line 1 a line 2 line 4 R sorts by using a random hash of keys ~/Test>sort -R testsorta line 25 line 5A line 18 line 3line 4 ~/Test>sort -R testsort5 line 5A line 1a line 2line 48 line 3

Egrep & Fgrep

Recent Posts, Blog, Linux, Tech Tips
EGREP:             The Command egrep is the same as running grep –E. egrep is used to search for a pattern using extended regular expressions. Terry@f:~/FinderDing>cat testsort A line 1 a line 2 8 line 3 line 4 5 line 5 Terry@f:~/FinderDing>egrep '^[a-zA-Z]' testsort A line 1 a line 2 line 4 *Show lines that start with a letter from alphabet Terry@f:~/FinderDing>cat html <!DOCTYPE html> <html> <body> <h1>My First Heading</h1> <p>My first paragraph.</p> </body> </html> Terry@f:~/FinderDing>egrep "My|first" html <h1>My First Heading</h1> <p>My first paragraph.</p> `*Find lines with pattern My first from html file FGREP: The command fgrep is the same as running grep –F. The Command searches for fixed character strings in a...