Edit Time: 2006/12/06
By: JonsenElizee
E-mail: JonsenElizee@163.com
##################################################
shell programming:
1: How to suppress the normal output when you grep
2: How to define a array and delete the first item using shift
3: How to subtring when awk
4: How to tr
##################################################
#How to suppress the normal output when you grep
grep 'keyword' ./directory/fileName -q
#OUTCOME NULL
##################################################
#How to subtring when awk
echo "Hello, World" | awk -F, '{print substr($1, 1, 3)}'
#OUTCOME Hel
##################################################
#How to define a array and delete the first item using shift
cat > run.csh
#!/bin/csh
echo $1
shift
echo $1
set v = (a "value1" b "value2")
echo $v
shift v
echo $v
#TO RUN THE SHELL
/bin/csh run.csh param1 param2
#OUTCOME
param1
param2
a value1 b value2
value1 b value2
#COMEOUT
##################################################
#How to tr
echo "hello" | tr 'a-z' 'A-Z'
#OUTCOME HELLO
##################################################
#How to ps and kill
ps -ef | grep keyword
kill processId