8/18/2014

rm dekim file and wz cube

fsrm  uds:/*/*.dekim
removes dekim file

rmwz uds:/*/*
removes wz cube

7/25/2014

Linux print sequential numbers

$seq 10 -1 0
10
9
8
7
6
5
4
3
2
1
0
       seq [OPTION]... LAST
       seq [OPTION]... FIRST LAST
       seq [OPTION]... FIRST INCREMENT LAST

5/09/2014

Linux join every 2 lines in a file

$ cat file
USA
442
India
249
UK
50$ 
paste - - -d, < file
USA,442
India,249
UK,50
 paste - - - - -d, <input_list_before_combine.list  # join every 4 lines, each "-" is one line
$ paste - - < file
USA 442
India 249
UK 50
from http://www.theunixschool.com/2012/03/join-every-2-lines-in-file.html

4/25/2014

Perl compare strings

You need to use 'eq' or 'ne' operator instead of  '==' or '!='

3/21/2014

windows key to minimize/maximize the window

1. Restore Down: Windows logo key + Down Arrow
2. Minimize: Windows logo key + Down Arrow
3. Select Window: Alt+ Tab 
4. Maximize: Windows logo key + Up Arrow

2/21/2014

2/17/2014

Fix "^m" at the end of line

fix line endings in vi:
:set fileformat=unix
:wq

2/14/2014

delete content of file1 from file2

grep -v -f file1 file2 > outfile

here outfile will have data other than file1 content

For exact match, use -Fx

grep -vFx -f file1 file2 > outfile

2/12/2014

delete empty lines from file

$ sed  '/^\s*$/d'  lineno_tape.list

1/13/2014

Grep

    grep smug files         {search files for lines with 'smug'}
    grep '^smug' files      {'smug' at the start of a line}
    grep 'smug$' files      {'smug' at the end of a line}
    grep '^smug$' files     {lines containing only 'smug'}
    grep '\^s' files        {lines starting with '^s', "\" escapes the ^}
    grep '[Ss]mug' files    {search for 'Smug' or 'smug'}
    grep 'B[oO][bB]' files  {search for BOB, Bob, BOb or BoB }
    grep '^$' files         {search for blank lines}
    grep '[0-9][0-9]' file  {search for pairs of numeric digits}


http://www.robelle.com/smugbook/regexpr4.txt

1/08/2014

Nominal Fold

Nominal Fold = geophone spacing * no. geophones / 2 * shot spacing

Nominal Fold = streamer length / 2 * shot spacing


1/06/2014

Putting Two Consecutive Lines into One Line with Perl / AWK

I have a data like below:
abcd
join abcd
efgh
join efgh
I want to join the two consecutive pair into one line. Resulting:
abcd join abcd
efgh join efgh

$ sed 'N;s/\n/ /' tst.list 
abcd join abcd
efgh join efgh

http://stackoverflow.com/questions/10220348/putting-two-consecutive-lines-into-one-line-with-perl-awk