Tuesday 24 September 2013

Working on the grep and awk in putty


grep-    grep is used in putty for pattern matching.

The grep command is used to search text or searches the given file for lines containing a match to the given strings or words. By default, grep displays the matching lines.



$ cat example.txt
UNIX operating system
UNIX and Linux operating system
Linux operation system

Now we want to search all lines in file example.txt which contains word UNIX but same time doesn't contain world Linux.
 
$ grep UNIX example.txt
UNIX operating system
UNIX and Linux operating system

Now to exclude all lines which contains Linux we will apply another grep command in this output with option -v to exclude matching word as shown in below grep command :


$ grep UNIX example.txt  | grep -v Linux
UNIX operating system





Read more: http://javarevisited.blogspot.com/2011/06/10-examples-of-grep-command-in-unix-and.html#ixzz2fnzlK6By


AWK is used for processing the rows and columns in a file. Awk has built in string function and associative arrays. It supports most of the operators, conditional blocks and loops available in C language.


How it works

oretail@abcd-xyz004|OID: ls -l

field1          field2  field3   field4             field5    filed6    field7        field8  filed9
-rw-rw-r--    1    oretail   orappadm         4        May      17           2012  1.abc
drwxrwxr-x   3    oretail   orappadm        256     Jun         29          2012  14159691
-rw-rw-r--    1    oretail   orappadm         4        May      17          2012  2.abc
-rw-rw-r--    1    oretail   orappadm         8       May       17          2012  3.abc

And among the 9 fields if we want to extract the field only then use the below command in unix box.

oretail@abcd-xyz|OID: awk '{print $1}' input_file
awk: 0602-533 Cannot find or open file input_file.
 The source line number is 1.



Same for column 2 ----8.

Now what I am doing in my project

After create the user changes in the Appoworx tool. I need to verify whether the count is same as per the sheet.

for that I need to connect to piand001 and login with  my credentials and password.

$ sudo su - appworx again ask for the password please provide the same. and all my user changes information present in the  u2/appworx/out

then ls -l | tail - (no of user changes done for the day )

 Now use the below command to sortout the logfiles.

$ grep -i user_name `ls -l o.RETAIL_USER_MAINT.*|grep "Sep 23"|awk '{print $9}'`|awk '{print $2}'

Meaning:  In ls -l field number 9 is file name.So it fill  get file name and grep for user_name in all the files
 of the date and the resulting output will be
o.RETAIL_USER_MAINT.6105052.00.log:export user_name="abendrok"
 in this field number 2 is user_name="abendrok"  it will print that. Space is used as separator.


Thanks & Have Fun...


Monday 23 September 2013

Install Oracle Developer Suite 10g on Windows7 (64-bit)

If you want to put up your hand in the Oracle Forms, then you need to install the database and oracle developer suite in the system.

It's depend on you what versions of database and developer suite will install on the system.

Here are the steps how you can install the Oracle Developer Suite 10g on Windows(64-bit) and solution of the some of the error while you might face during the installation.

Step1.  You need to download the whole package from the OTN.
Step2:   Right Click on the Setup file and choose the compatibility to make it Windows XP SP2.
Step3: Edit the Virtual Size (You may get an error intial part of the installation if you didn't set it correctly.)
Step4: Run the setup.exe

Setting of Virtual Memory.

Depending upon your actual memory avialable with you computer,set up virtual memory.  You can go upto the double the size of the actual memory while setting up the virtual memory in your system.

 Right click on My Computer > Properties > Advance System Settings (left panel) > Select Advance Tab > Under Performance area click on Settings> Go to Advance Tab > In Virtual Memory select Change button






Now in 2nd Step: After setup the virtual memory in your system you need to restart your system to see the actual effect.

3rd Step: Open the disk1 folder of the developer suite and locate "setup.exe" as shown in the below picture.
 

4th Step:  Right Click on the setup.exe and change the compatibilty to windows XP service pack 2 or 3.

























Step5: Go on click as you Install other software and when it ask for enter the disk2  browse and choose the disk 2.

And you will be done .

Now some possible error might you face while Installing the software.

Above one ( Setting of Virtual Memory One among them and it's the primary error you will face )


Please refer the below blogspot for poosiblity of generating the errors  and their respective errors.

http://shahiddba.blogspot.in/2012/05/install-oracle-developer-suite-10g-on.html