Thursday, February 18, 2010

Replace string in 'n' files in one shot!

Change a pattern in all the files in one go!

#!/bin/sh

for file in $(grep -il "devdb" *.sql)

do

sed -e "s/devdb/testdb/g" $file > /tmp/tempfile.tmp

mv /tmp/tempfile.tmp $file

done

Monday, February 15, 2010

Change default date format

In Order to change the date format through Personalization, please follow the steps given below:

1. Navigate, Root > People Tools > Personalization > Personalization Options > Search

Here, you will get the option for the different application for which you want to change the Date Format or you can also choose PPTL (People Tools) which change the Date Format in the Tools itself.

Choose, PPTL.

2. Look for a Definition : DFRMT, for the Date Format.

3. On the Format Tab, just click on this Tab.

4. Now, click on the "Set Option Default Value".

5. Change the Option Default Value as per your requirement MMDDYY and click OK.

Ofcourse! Save

Wednesday, January 27, 2010

Change Assitant parameters

PeopleBook Change assistant.

#Project= Used primarily for functions that require a project name; for example, Build Project.

#Directory= Used when you need to run a script that is not located

in the \scripts directory, for example, STOREPT. In this case, you could enter:

#Directory=#PT_PSHOMEsrc\cbl\base\

#P1= through #P5= Used to pass parameters to SQR reports, for example,

TEST.sqr. In this case, you would pass the necessary value, such as:

#P1=#OutputDirectory

#PTPS_HOME= Used to specify the variable that is defined

on the Directory tab of the Change Assistant options (Options, Change Assistant, Directories tab).

#OutputDirectory= Used to specify the Output Directory variable that is defined in the Options, Change Assistant, Directories screen.

#NT= Used for DB2

#Type= Enables you to specify the type of record to insert into the project. Choose from the following record types:

All Records

Table

View/Query View

Derived

SubRecord

Stored Procedure

Temporary Table

Dynamic View

#RCID= Enables the user to override the

Sunday, November 1, 2009

ssh using secure file method

Setting SSH on a machine using security file for direct ssh

Client:- The system from which the ssh session will be started via the ssh command

Server:- The system that the ssh session connects to

Steps to taken on the client :

On the client run the following commands:

  1. $ mkdir -p $HOME/.ssh
  2. $ chmod 0700 $HOME/.ssh (set the security on .ssh folder)
  3. $ ssh-keygen -t rsa -This should result in two files, $HOME/.ssh/id_rsa (private key) and $HOME/.ssh/id_rsa.pub (public key).
  4. Copy $HOME/.ssh/id_rsa.pub to the server.
  5. On the server run the following commands: $ cat id_rsa.pub >> $HOME/.ssh/authorized_keys2
    $chmod 0600 $HOME/.ssh/authorized_keys2
    Depending on the version of OpenSSH the following commands may also be required:

$ cat id_rsa.pub >> $HOME/.ssh/authorized_keys

$ chmod 0600 $HOME/.ssh/authorized_keys

An alternative is to create a link from authorized_keys2 to authorized_keys:

$ cd $HOME/.ssh && ln -s authorized_keys2 authorized_keys

On the client test the results by ssh'ing to the server

$ ssh -i $HOME/.ssh/id_rsa server

(Optional) Add the following $HOME/.ssh/config on the client:

Host server

IdentityFile ~/.ssh/id_rsa

This allows ssh access to the server without having to specify the path to the id_rsa file as an argument to ssh each time.