Jumat, 03 Desember 2010

Myjob : kemajuan1

KATALOG TSUNAMI INDONESIA 1990 - 2010


 



#!/bin/csh
gmtset ANNOT_FONT_SIZE_PRIMARY 10p HEADER_FONT_SIZE 18p PLOT_DEGREE_FORMAT ddd:mm:ssF
set area = 90/140/-15/9
set psfile = top.ps
set grdfile=./indo.nc
set cptfile=color.cpt
makecpt -Cglobe -Z > $cptfile
grdgradient $grdfile -A30/270 -Gintens.grd -Nt0.30 -V
grdimage $grdfile -R$area -JM18c -C$cptfile -Iintens.grd -P -K -X1.5 -Y8 >! $psfile


gmtset ANOT_FONT_SIZE 9
pscoast -R$area -JM18c  -Df -W2,100 -P -Ba4f2/a4f2NWSE -O -K >> $psfile

awk -F, '{ print $1, $2}' ./trench.gmt | psxy -R$area -J -Gdarkblue -Sc0.05 -O -K >> $psfile
awk -F, '{ print $1, $2}' ./transform.gmt | psxy -R$area -J -Gdarkblue -Sc0.05 -O -K >> $psfile
awk -F, '{ print $1, $2}' ./ridge.gmt | psxy -R$area -J -Gdarkblue -Sc0.05 -O -K >> $psfile
awk -F, '{ print $1, $2}' ./cobi.d | psxy -R$area -J -Gyellow -W1 -Sa0.2 -O -K >> $psfile

sed -n '2,3p' test.txt | psxy -R$area -JM -Ggray -W1 -O -K >> $psfile
sed -n '5,6p' test.txt | psxy -R$area -JM -Ggray -W1 -O -K >> $psfile
sed -n '8,9p' test.txt | psxy -R$area -JM -Ggray -W1 -O -K >> $psfile
sed -n '11,12p' test.txt | psxy -R$area -JM -Ggray -W1 -O -K >> $psfile
sed -n '14,15p' test.txt | psxy -R$area -JM -Ggray -W1 -O -K >> $psfile
sed -n '17,18p' test.txt | psxy -R$area -JM -Ggray -W1 -O -K >> $psfile
sed -n '20,21p' test.txt | psxy -R$area -JM -Ggray -W1 -O -K >> $psfile
sed -n '23,24p' test.txt | psxy -R$area -JM -Ggray -W1 -O -K >> $psfile
sed -n '26,27p' test.txt | psxy -R$area -JM -Ggray -W1 -O -K >> $psfile
sed -n '29,30p' test.txt | psxy -R$area -JM -Ggray -W1 -O -K >> $psfile
sed -n '32,33p' test.txt | psxy -R$area -JM -Ggray -W1 -O -K >> $psfile
sed -n '35,36p' test.txt | psxy -R$area -JM -Ggray -W1 -O -K >> $psfile
sed -n '38,39p' test.txt | psxy -R$area -JM -Ggray -W1 -O -K >> $psfile
sed -n '41,42p' test.txt | psxy -R$area -JM -Ggray -W1 -O -K >> $psfile
sed -n '44,45p' test.txt | psxy -R$area -JM -Ggray -W1 -O -K >> $psfile
sed -n '47,48p' test.txt | psxy -R$area -JM -Ggray -W1 -O -K >> $psfile
sed -n '50,51p' test.txt | psxy -R$area -JM -Ggray -W1 -O -K >> $psfile
sed -n '53,54p' test.txt | psxy -R$area -JM -Ggray -W1 -O -K >> $psfile
sed -n '56,57p' test.txt | psxy -R$area -JM -Ggray -W1 -O -K >> $psfile
sed -n '59,60p' test.txt | psxy -R$area -JM -Ggray -W1 -O -K >> $psfile
sed -n '62,63p' test.txt | psxy -R$area -JM -Ggray -W1 -O -K >> $psfile
sed -n '65,66p' test.txt | psxy -R$area -JM -Ggray -W1 -O -K >> $psfile
sed -n '68,69p' test.txt | psxy -R$area -JM -Ggray -W1 -O -K >> $psfile
sed -n '71,72p' test.txt | psxy -R$area -JM -Ggray -W1 -O -K >> $psfile
sed -n '74,75p' test.txt | psxy -R$area -JM -Ggray -W1 -O -K >> $psfile
sed -n '77,78p' test.txt | psxy -R$area -JM -Ggray -W1 -O -K >> $psfile
sed -n '80,81p' test.txt | psxy -R$area -JM -Ggray -W1 -O -K >> $psfile
sed -n '83,84p' test.txt | psxy -R$area -JM -Ggray -W1 -O -K >> $psfile
sed -n '86,87p' test.txt | psxy -R$area -JM -Ggray -W1 -O -K >> $psfile
sed -n '89,90p' test.txt | psxy -R$area -JM -Ggray -W1 -O -K >> $psfile

psmeca focaltop_cmt.gmt -R$area -JM -Sm0.25c/-1 -Gred -W1 -O -K >> $psfile
pstext cibi.txt -R$area -JM -Gblack -O -K >> $psfile

psscale -C$cptfile -Iintens.grd -D0.4c/1/2/0.15 -B2000 -P -O -X20c -Y5c >> $psfile

Cut command linux

cut

cut options [files]
Cut out selected columns or fields from one or more files.





In the following options, list is a sequence of integers. Use a comma between separate values, and a hyphen to specify a range (e.g., 1-10,15,20 or 50-). See also paste and join.

Options

-b list, --bytes list
Specify list of positions; only bytes in these positions will be printed.
-c list, --characters list
Cut the column positions identified in list. Column numbers start with 1.
-d c, --delimiter c
Use with -f to specify field delimiter as character c (default is tab); special characters (e.g., a space) must be quoted.
-f list, --fields list
Cut the fields identified in list.
-n
Don't split multibyte characters.
-s, --only-delimited
Use with -f to suppress lines without delimiters.
--output-delimiter=string
Use string as the output delimiter. By default, the output delimiter is the same as the input delimiter.
--help
Print help message and exit.
--version
Print version information and exit.

Examples

Extract usernames and real names from /etc/passwd:
cut -d: -f1,5 /etc/passwd
Find out who is logged on, but list only login names:
who | cut -d" " -f1
Cut characters in the fourth column of file, and paste them back as the first column in the same file:
cut -c4 file | paste - file

  1. cut -c1-3 text.txt
    Output:
    Thi
    Cut the first three letters from the above line.
  2. cut -d, -f1,2 text.txt
    Output:
    This is, an example program
    The above command is used to split the fields using delimiter and cut the first two fields.

Sed command linux

sed
(=stream editor) I use sed to filter text files. The pattern to match is typically included between a pair of slashes // and quoted.
For example, to print lines containing the string "1024", I may use:
cat filename | sed -n '/1024/p'
Here, sed filters the output from the cat command. The option "-n" tells sed to block all the incoming lines but those explicitly matching my expression.  The sed action on a match is "p"= print.
Another example, this time for deleting selected lines:

cat filename | sed '/.*o$/d' > new_file

In this example, lines ending the an "o" will be deleted. I used a regular expression for matching any string followed by an "o" and the end of the line. The output (i.e., all lines but those ending with "d") is directed to new_file.
Another example. To search and replace, I use the sed 's' action, which comes in front of two expressions:

cat filename | sed 's/string_old/string_new/' > newfile

A shorter form for the last command is:
sed 's/string_old/string_new/' filename > newfile
To insert a text from a text file into an html file, I may use a script containing:
sed '/text_which_is_a_placeholder_in__my_html_file/r text_file_to_insert.txt' index_master_file.html > index.htmll

sed G myfile.txt > newfile.txt
In the above example using the sed command with G would double space the file myfile.txt and output the results to the newfile.txt.
sed = myfile.txt | sed 'N;s/\n/\. /'
The above example will use the sed command to output each of the lines in myfile.txt with the line number followed by a period and a space before each line. As done with the first example the output could be redirected to another file using > and the file name.
sed 's/test/example/g' myfile.txt > newfile.txt
Opens the file myfile.txt and searches for the word "test" and replaces every occurrence with the word "example".
sed -n '$=' myfile.txt
Above this command count the number of lines in the myfile.txt and output the results.


Laman