Showing posts with label usage. Show all posts
Showing posts with label usage. Show all posts

Thursday, 31 March 2016

echo the 'echo'




"echo" command is the very basic command of Linux/Unix. Most of us known this command to print whatever is being passed to it as argument. So let's revise once more if we are missing something here.


"echo" command prints its argument by single space.
[atul@localhost ~]$ echo Atul learns commands 
Atul learns commands

print argument by single space mean it will suppress the space between its arguments.
[atul@localhost ~]$ echo Atul          learns                         commands 
Atul learns commands

if you want to preserver the space between them, we need to make these 3 argument to 1 by using a quote.
[atul@localhost ~]$ echo "Atul     learns   commands" 
Atul     learns   commands



One more example :



** Need to remember -
* echo expect arguments to print whether they are separated by single space or multiple, it will print them with single space
* if you want to keep multiple space in argument string, make them one argument by quoting them.





Monday, 4 January 2016

Monitoring Memory by DataStage Processes #2



You can find other parts here -> Monitoring Memory by DataStage Processes #1



Continuously capturing memory usage of all osh processes -


$ while:; do date; ps -e -o pid,ppid,user,vsz,time,args |grep -v grep| grep osh; sleep 3;done

To Stop, Use Ctrl-C

osh processes are processes created by DataStage parallel jobs. This command is used to monitor all osh processes over a period of time. In this example, the grep command is used to filter processes with the string “osh” but this can be modified if you want to filter processes by something else such as user ID or ppid. This loop is started every second but can also be modified by increasing the value after the sleep command. This command will continue to run until you press Ctrl + c.



Monitoring only new processes:

Sometimes it is difficult to find a common string to filter the processes you want to monitor. In those cases, and assuming that you can reproduce the problem or condition you want to analyze, you can use this script to keep track of all new processes.

This script will help us to monitor the new processes generated after this script 'ps_new.sh'. With this script, we can monitor the process of datastage job, which is executed after this script execution, specifically.

=======================================================================
=======================================================================

How to Use this script?

1. Run the script ps_new.sh
     ./ps_new.sh
2. Start the datastage job or reproduce the issue
3. Press Ctrl-C to stop the script ps_new.sh
4. Analyse the output file generated by script






Like the below page to get update  
https://www.facebook.com/datastage4you
https://twitter.com/datagenx
https://plus.google.com/+AtulSingh0/posts
https://groups.google.com/forum/#!forum/datagenx

Wednesday, 28 October 2015

Left and Right String Function - DataStage Transformation



Today, we will discuss two more datastage transformer functions - Left & Right.  These two functions use to get or cut the string from the input data, Let's have a look -


Left(input, number)  
input : - input column
number :- the no of characters you want to fetch from Left most of string


input = 'This is a test of fuctions."

Left(input,9)  =    'This is a'
Left(input, 3) =    'Thi'

Right(input, number)
input : - input column
number :- the no of characters you want to fetch from Right most of string


input = 'This is a test of fuctions."

Right(input,9)  =    'fuctions.'
Right(input, 14) =    't of fuctions.'


Use of Left/Right function to get SubString -

These functions used to get substring from an input if the start and end character location known or can be derived. Let's see an example -

we need to cut input from 2nd to 6th character

input = 'This is a test of fuctions."

left(input, 6) = 'This i'           #left function cut the left 6 character
Right(left(input,5),5) = 'his i'    #Use right func, to cut right 6-2+1 = 5 char 






Like the below page to get update  
https://www.facebook.com/datastage4you
https://twitter.com/datagenx
https://plus.google.com/+AtulSingh0/posts
https://groups.google.com/forum/#!forum/datagenx