Category Archives: Daily Hacks

Hack #21 -> Sed Basics – Find and Replace Using RegEx

This hack explains how to use sed substitute command “s”. The `s’ command is probably the most important in `sed’ and has a lot of different options. The `s’ command attempts to match the pattern space against the supplied REGEXP; if the match is successful, then that portion of the pattern space which was matched is replaced with REPLACEMENT. Syntax:

Read more

Hack #18 -> Diff Command

Diff command compares two different files and reports the difference. The output of the diff command is very cryptic and not straight forward to read. Syntax: diff [options] file1 file2   What was modified in my new file when compare to my old file?   The option -w in the diff command will ignore the white space while performing the

Read more

Hack #17 -> Stat Command

Stat command can be used either to check the status/properties of a single file or the filesystem. Display statistics of a file or directory.   $ stat /etc/my.cnf File: `/etc/my.cnf’ Size: 346 Blocks: 16 IO Block: 4096 regular file Device: 801h/2049d Inode: 279856 Links: 1 Access: (0644/-rw-r–r–) Uid: (0/root) Gid: (0/root) Access: 2009-01-01 02:58:30.000000000 -0800 Modify: 2006-06-01 20:42:27.000000000 -0700 Change:

Read more
« Older Entries