8 Powerful Awk Built-in Variables – FS, OFS, RS, ORS, NR, NF, FILENAME, FNR

8 Powerful Awk Built-in Variables – FS, OFS, RS, ORS, NR, NF, FILENAME, FNR

Advertisements

difference between different shells

sh   csh  ksh  bash tcsh zsh  rc   es

Job control N Y Y Y Y Y N N
Aliases N Y Y Y Y Y N N
Shell functions Y(1) N Y Y N Y Y Y
"Sensible" Input/Output redirection Y N Y Y N Y Y Y
Directory stack N Y Y Y Y Y F F
Command history N Y Y Y Y Y L L
Command line editing N N Y Y Y Y L L
Vi Command line editing N N Y Y Y(3) Y L L
Emacs Command line editing N N Y Y Y Y L L
Rebindable Command line editing N N N Y Y Y L L
User name look up N Y Y Y Y Y L L
Login/Logout watching N N N N Y Y F F
Filename completion N Y(1) Y Y Y Y L L
Username completion N Y(2) Y Y Y Y L L
Hostname completion N Y(2) Y Y Y Y L L
History completion N N N Y Y Y L L
Fully programmable Completion N N N N Y Y N N
Mh Mailbox completion N N N N(4) N(6) N(6) N N
Co Processes N N Y N N Y N N
Builtin artithmetic evaluation N Y Y Y Y Y N N
Can follow symbolic links invisibly N N Y Y Y Y N N
Periodic command execution N N N N Y Y N N
Custom Prompt (easily) N N Y Y Y Y Y Y
Sun Keyboard Hack N N N N N Y N N
Spelling Correction N N N N Y Y N N
Process Substitution N N N Y(2) N Y Y Y
Underlying Syntax sh csh sh sh csh sh rc rc
Freely Available N N N(5) Y Y Y Y Y
Checks Mailbox N Y Y Y Y Y F F
Tty Sanity Checking N N N N Y Y N N
Can cope with large argument lists Y N Y Y Y Y Y Y
Has non-interactive startup file N Y Y(7) Y(7) Y Y N N
Has non-login startup file N Y Y(7) Y Y Y N N
Can avoid user startup files N Y N Y N Y Y Y
Can specify startup file N N Y Y N N N N
Low level command redefinition N N N N N N N Y
Has anonymous functions N N N N N N Y Y
List Variables N Y Y N Y Y Y Y
Full signal trap handling Y N Y Y N Y Y Y
File no clobber ability N Y Y Y Y Y N F
Local variables N N Y Y N Y Y Y
Lexically scoped variables N N N N N N N Y
Exceptions N N N N N N N Y

Key to the table above.

Y Feature can be done using this shell.

N Feature is not present in the shell.

F Feature can only be done by using the shells function
mechanism.

L The readline library must be linked into the shell to enable
this Feature.

Notes to the table above

1. This feature was not in the orginal version, but has since become
almost standard.
2. This feature is fairly new and so is often not found on many
versions of the shell, it is gradually making its way into
standard distribution.
3. The Vi emulation of this shell is thought by many to be
incomplete.
4. This feature is not standard but unoffical patches exist to
perform this.
5. A version called 'pdksh' is freely available, but does not have
the full functionality of the AT&T version.
6. This can be done via the shells programmable completion mechanism.
7. Only by specifing a file via the ENV environment variable.
 
http://www.faqs.org/faqs/unix-faq/shell/shell-differences/ 

mysql auto increment Reset

in order to reset the auto_increment, in a situation where some of the most recently added rows were deleted, use:

ALTER TABLE theTableInQuestion AUTO_INCREMENT=1234

and future insertions will be numbered from 1234 again (unless you still had rows numbered greater than 1234, and then the future insertions will start from the greatest number + 1 ).

checking Ip address of amazon after reboot

every time you reboot or stop/start an instance, you are assigned new public and private IP addresses and hostnames
with this script you can get the new IP and hostname of instance, so that you can use it later

#!/bin/sh
META=http://169.254.169.254/latest/meta-data
HOSTNAME=`/usr/bin/curl -s $META/hostname | /bin/sed ‘s+\..*++g’`
hostname $HOSTNAME
echo $HOSTNAME > /etc/hostname
IPV4=`/usr/bin/curl -s $META/public-ipv4

http://169.254.169.254 is an internal Amazon EC2 server that will report information about your instance—very helpful if you haven’t installed the EC2 API tools

Cloud Myths

Myth #1: “I’m using virtualization/hypervisors in my data center — I’m already running a cloud.”

 

Virtualization, or more properly “operating system virtualization” (typically implemented by a hypervisor) is an important component of a cloud infrastructure, but by itself, does not implement cloud semantics. When a user requests a collection of virtual machines (VMs) from a cloud, the VMs must be isolated from other VMs on the system in terms of their CPU access, memory access, network access, and access to persistent storage. Furthermore all of these forms of isolated access must be associated with an authenticated user for security and charging purposes. Operating system virtualization and hypervisors provides unauthenticated isolation of CPUs and memories, but not a private inter-VM network and not per-allocation persistent storage. Thus a cloud needs virtualization for part of its function, but data center virtualization, by itself, does not implement a cloud.

 

Clouds also provide a way for a cloud administrator to define either Service Level Agreements (SLAs) or Quality-of-Service (QoS) specifications that categorize the quality of access (and the resulting charging rate) individual users will experience. Thus, in a cloud, an administrator defines a set of SLAs, groups users according to the SLAs to which they are entitled access, and determines a charging rate for each active SLA. Alternatively, in a virtualized data center, the system administrators can use virtualization to control allocation of VMs to resources, but the notion of QoS or SLA is not exported to the end user as a way of enabling self-service provisioning.

 

In short, data center virtualization, alone, does not constitute cloud computing.

 

Myth #2: “Cloud Computing is just Grid Computing by a different name.”

 

There are several ways in which Cloud Computing and Grid computing are distinct from a conceptual point of view. First, Grids are architected so that a small number of users can gather and use most, if not all of the resources in the grid. While those resources are in use, other users must wait (typically in one or more priority queues) for resource access. Because the duration and frequency of individual user resource allocations is highly variable and hard to predict, queuing delays can be quite substantial, particularly in settings where machine utilization is high.

 

In contrast, clouds provide the illusion of “infinite scale” by supporting a large number of users, each of which is entitled to only a small fraction of the total cloud resource pool. By ensuring that the cloud is provisioned to support the total number of possible simultaneous users (each requesting his or her maximum possible allocation), the resource usage pattern of any single user cannot cause a resource shortage. Thus cloud resource allocations are “on-demand” (resources are returned to the user when they are requested without queuing delay) and atomic (an entire resource allocation request is typically satisfied without the possibility of partial allocation failure).

 

Another way in which clouds and grids are distinct is that grids support inter-grid federation below the API level. That is, a user of a grid expects that the grid infrastructure will enable him or her to access resources in other grids somewhat transparently and under the control of the grid. As a result, grids are typically implemented as federated middleware that requires extensive and often complex policy mediation support. This need for policy mediation to be managed by the grid middleware can lead to non-intuitive or non-deterministic behavior that users may interpret as grid instability.

 

Currently clouds implement federation at the API level. A user can make requests from multiple clouds simultaneously and if the cloud allocations allow routing to and from an external network, these allocations can be combined under user control. Thus policy mediation occurs at the application level on a per-user basis making inconsistencies locally scoped and easier to rectify.

 

Thus, from the perspective of both the end-user and the infrastructure administrators, grids and clouds are distinct.

 

Myth #3: “Clouds provide infinite scale.”

 

Public clouds like those operated by Amazon or Google certainly comprise larger resource pools than most individual users or organizations could use effectively. Thus it is tempting to believe that from the perspective of a single user, the amount of resource available is effectively limitless.

 

This notion of infinite resource availability would be true, in practice, if each cloud were only to service a small user community and each user were not quota limited. In many application domains, however, individual users do have large resource needs. So large, in fact, that if many of them (or even several of them) were to make large requests simultaneously even the largest clouds would run short of resources to provide. For these users, the cloud does not appear infinite.

 

Indeed, public clouds limit the total resource footprint that a “standard” user can control to a small quota, for this reason. Special users (after careful vetting) can have their quota increased but no user will be allowed to consume a substantial fraction of the total resource pool for fear of causing a resource shortfall. For the vast majority of users who are using the public clouds to implement dynamically scaling web sites, the quota allowed is larger than these web sites typically require, thereby providing the illusion of infinite scale. As resource-intensive, highly scalable applications begin to use cloud computing as either a public or on-premise platform, however, they will begin to reach the scaling limits imposed by resource availability.

 

This difference also obscures the relationship between private and/or hybrid clouds and use of the public clouds. Data center operators occasionally cite the availability of “infinite resources” as a reason to use the public clouds instead of an on-premise cloud or a hybrid cloud. In practice, most good-sized data centers have resource requirements that will exceed both, particularly if they are striving for high utilization levels. Public clouds offer the ability to “spill out” or “burst” from a data center into a public cloud utility and vice versa if there is a resource shortfall. Better, more efficient, and user-controlled resource usage is possible through a combination of public and private clouds. Infinite scale, however, is an illusion provided to users with only small to modest maximum requirements.

 

Myth #4: “Clouds only provide ‘pay-as-you-go’ access.”

 

One of the most attractive features of the public clouds is that they allow users to change their resource usage dynamically in response to customer demand or offered load, and to pay only for the resources being used from moment to moment. While this type of charging is an important feature, it is by no means the only method a cloud can and should support. In particular, if an allocation is to be shared among several users within a single organization, it may make more sense to offer a maximum resource quota on a subscription basis to keep conflicting resource needs from causing confusion. If multiple users are to share the VMs within a single allocation, enabling all of them to acquire and release resources dynamically (possible resources in use by other users of the allocation) can lead to chaos.

“Legal Disclaimer: This electronic message and all contents contain information from Cybage Software Private Limited which may be privileged, confidential, or otherwise protected from disclosure. The information is intended to be for the addressee(s) only. If you are not an addressee, any disclosure, copy, distribution, or use of the contents of this message is strictly prohibited. If you have received this electronic message in error please notify the sender by reply e-mail to and destroy the original message and all copies. Cybage has taken every reasonable precaution to minimize the risk of malicious content in the mail, but is not liable for any damage you may sustain as a result of any malicious content in this e-mail. You should carry out your own malicious content checks before opening the e-mail or attachment.” http://www.cybage.com