CUT
cat h1 | cut -c9- to print characters after 9th coloumn
cut -d: -f2,2 h2 to print the second field with ":" as a seprater
cut -d" " -f7- h2 for using space as a delimiter
cut -d" " -c 1-9 extracts the first 9 characters of each line
SED
sed "s/###/\"/user"/g" WWW.html
echo $home | sed "s/\//#/g" | sed "s/#/\\\//g"
sed "s/###/\"/user"\"/mittal"/g" WWW.html > zz
sed "s/###/\/user\/mittal/g" WWW.html > YY
Lower Case to upper Case
sed -e 's/\(.*\)/\U\1/'
Upper Case to Lower Case
sed -e 's/\(.*\)/\L\1/'
ENTITYlc=`echo ${ENTITY} | sed
'y@ABCDEFGHIJKLMNOPQRSTUVWXYZ@abcdefghijklmnopqrstuvwxyz@'`
Lower Case to Upper Case
ENTITYuc=`echo ${ENTITY} | sed
'y@abcdefghijklmnopqrstuvwxyz@ABCDEFGHIJKLMNOPQRSTUVWXYZ@'`
WHILE
#!/bin/csh
@ i = 1
while ($i != 10)
echo $i
@ i ++
end
CRYPT
$ crypt key1 < file1 > crypted_file2
the above command used a key called key to crypt file1 and gives
output
as crypted_file2
TO decrypt crypted_file2
crypt key < crypted_file2
EXAMPLE Script File
tables.csh
#!/bin/csh -f
\rm -rf f0 f1 f2 f3 f4 f5
@ i = 12 ;
while ($i < 31)
#while ($i < 15)
#\rm f1
@ j = 1 ;
while ($j < 11)
echo "$i * $j " >> f1
@ j ++
end
##echo "" >> f1
echo $i >> f0
@ i ++
end
cat f1 | bc > f3
paste f1 f3 > f4
paste -d "" f1 f3 > f4
awk '{print $1 " " $2 " " $3 "
= "$4}' f4 > result
cat result | sed "s/*/X/g" >> res_fin
#\rm f0 f1 f2 f3 f4 f5 result
find_list1_in_list2.csh
foreach i ( `cat cent` )
? set aa = `grep $i cent.vhdl`
? set bb = `echo $aa | awk '{print $1}'`
? if ($bb == "") echo $i >> f1
? endif
? end
gen_num.scr
#!/bin/csh
@ i = 1
while ($i != 10)
echo $i
@ i ++
end
TEMPLATE SCRIPT
#!/bin/csh -f
set title = `basename $0`;
###########################
# FOR ARGUMENTS
###########################
if ($#argv == 0) then
set error = "Invalid number of arguments;At
least One expected"
echo "ERROR ($title) :" $error;
#----------> set here the -h option to be displayed.
exit
endif
cat ~mittal/DOCS/tele | grep -i ^$argv[1]
DISPLAY Problems:
xhost +
setenv DISPLAY 'hostname'
rup to see load
related to rup rpc.rstatd
unix> rpc.rstatd
to make rup work
FONTS in LINUX
xlsfonts : to see the
font list
xterm -font <font name from the list>
example
xterm -font lucidasanstypewriter-14
SETENV
setenv working_dir `pwd`
setenv unit $working_dir:t sets unit to the last word in
path name(tail)
setenv unit_path $working_dir:h sets unit to the path minus the
last word in path
Example:
if working_dir = /homes/amittal/misc then
$unit = misc
$unit_path = /homes/amittal
Auto FTP Script:
---------------------------------------------------------------------------------------
#!/bin/csh -f
set title = `basename $0`;
if ($#argv < 2) then
set error = "Invalid
number of arguments;At least One expected"
echo "ERROR
($title) :" $error;
echo "Usage: unix>
put <remote_dir_name> <local_file_name>"
echo "Example: unix>
put perl index.html"
exit
endif
mv ~/.netrc ~/.netrc.bk
sed -e "s/dir/$argv[1]/g" -e
"s/filename/$argv[2]/g" ~/.netrc_put > ~/.netrc
chmod 600 ~/.netrc
ftp vlsiip.com
------------------------------------------------------------------------------------------------
~/.netrc_put file is as
follows
IMP: do not forget to include the last null line: otherwise it wont
work.
------------------------------------------------------------------------------------------------
-------------------------------
machine vlsiip.com
login vlsiip
password guest123
macdef init
bin
cd www
cd dir
put filename
bye
--------------------------