Categories
Q & A Q & A Code

⨘ } awk miscellaneous commands

1. Extract pattern from file and do sum of all entries matching the pattern grep ” Sequential ” idle_power.txt | awk ‘{sum += $3} END {print sum}’ Here $3 is which column is to get sum of. Idea is to grep a certain pattern from file from each line and then process output by awk […]

 2,219 total views

Categories
Q & A Q & A Code

⨘ } Math Equations in Keynote / LaTeX

Apple Keynote takes Latex format equations. Some useful commands are below. x^2 + y^2 = z^2 If you like to have subscripts x_n^2 + y_n^2 = z_n^2 Greek letters \alpha \beta \gamma \rho \sigma \delta \epsilon Operators \times \otimes \oplus \cup \cap < > \subset \supset \subseteq \supseteq \int \oint \sum \prod \times \div \cup […]

 1,865 total views,  2 views today

Categories
Q & A Q & A Code

⨘ } clearcase version control useful commands

Set alias alias ct /usr/atria/bin/cleartool Version ct -ver List vob ct lsvob List views ct lsview ct lsview view-tag Create a tag ct mktag -view -tag tag-name Set a view ct setview view-name Print current view ct pwv List history ct lshistory file-name List private files ct lsprivate List checkout files ct lsco -r -l […]

 3,259 total views,  5 views today

Categories
Q & A Q & A Code

⨘ } vi / vim / gvim editor useful commands

Some common settings you may want to keep in .vimrc file set number set backspace=indent,eol,start set hlsearch set shiftwidth=3 set tabstop=3  3,271 total views

 3,271 total views

Categories
Q & A Q & A Code

⨘ } extract a pattern from file – perl

#!/usr/bin/perl use strict; use warnings; open my $FH, ‘<‘, $ARGV[1] or die “Could not open file: $ARGV[1] $!\n”; open my $EXT_FH, ‘>’, $ARGV[2] or die “Could not open file: $ARGV[2] $!\n”; while (my $line = <$FH>){ if ($line =~ /cabist|tap|fscan|fbscan|dangle) print $EXT_FH $line; } close $FH; close $EXT_FH;  1,747 total views

 1,747 total views

Categories
Q & A Q & A Code

⨘ } git version control useful commands

1. clone from repository git clone $GIT_REPOS/ip cloned-ip where: $GIT_REPOS is path to git repository if you like to have little fancy to organize cloned versions with dates, i prefer this way: git clone $GIT_REPOS/ip ip-`date +%Y%b%d-%H%M` also you can further use alias to have this command as: alias hrclone “$GIT_REPOS/ip ip-hr-‘date +%Y%b%d-%H%M’” 2. list […]

 3,049 total views

Categories
Q & A Q & A Code

⨘ } Linux / Unix useful commands

1. compress and archive the directory / folder tar -zcvf /home/folder.tar.gz /home/folder where: z: compress archive using gzip program c: create archive on linux v: verbose, show progress on screen f: archive file name 2. secure copy from remote server to local scp user_name@ip_address:/home/folder/file /local_dir/copied_files/ 3. secure copy from local to remote server scp /local_dir/file […]

 1,786 total views

Categories
Q & A Q & A Code

⨘ } recursive folder structure based on excel spreadsheet information – perl

Below a simple perl script to make directory folder structure which may be helpful for you if you need to deal with thousands of folders. Example: folder_structure.csv (you may extract csv fromat from excel sheet). We need to make folder structure as continent folder contains regions, regions contains countries, each country contains states etc. ASIA,SOUTH […]

 1,088 total views

Categories
Q & A Q & A Code

⨘ } vi Editor: quick guide }

This lecture provides a quick overview of vi editor.  6,495 total views

 6,495 total views