29December 2008

Many users are asking how to handle an unix or shell script within php. Here is a simple way to call a sample bash script inside php script page and have a return value printed to your web page. This is achieved by using “system” call in php that invokes the shell script. Here is the Read More

24December 2008

Just had an issue to add single quotes to first char of the flat file. I tried this below and it is working sed -e "s/^/\’/g" filename The file image before Read More

18December 2008

#!/bin/sh echo "enter two numbers" read a b c=$(($a+$b)) echo "$a + $b = $c" # or let c="$a+$b" echo "$a + $b is $c" SHARETHIS.addEntry({ title: "Linux Unix Shell script - How to add integers in bash? - sample", url: Read More

18December 2008

Here is the sample script to how how to read an unix or linux file using shell script: #!/bin/sh FILENAME="mydatafile.txt" while read line do echo $line done < $FILENAME #!/bin/sh FILENAME="mydatafile.txt" LN=0 cat $FILENAME | while read FILE_NAME do LN=$(($LN + Read More

17December 2008

Question: I generally use Perl for this ex. perl -e ’s/pattern/replace/g’ -p -i I did something like this.. find . -type f -exec perl -e ’s/pattern/replace/g’ -p -i {} \; I want to do this with “sed” but what I get is the output being printed on the screen.. i Read More

10December 2008

Find the speed of your Ethernet card in Linux For logging on to the net or for attaching as a node on a LAN, your computer needs a network card. The network card forms the interface between your computer and the network. There are different kinds of network cards available in the market depending Read More

10December 2008

Here is the script I often used to find the sql script using oracle trace utility for oracle applications forms, reports. Change the user id, password and database name to suit your environment. Download TKprof shell script #!/bin/sh #*********************************************** # Script Read More

10December 2008

Here is the script to debug the arguments with in bash script. This is very useful script to check the arguments and handle it in any shell script. Download Passing arguments to the shell script #!/bin/bash #************************************************ # Script Name: pass_arg # Developed by Read More

10December 2008

There were requirements for me to filter and extract only html tag links from a web page. I could create a sample page. There are many ways to get it, and even through may utilities. Here is one among them - handy for you. Download the Extract Html Bash Read More

1December 2008

This script provides an sample, and then the practical example to connect to oracle database, extract data like excel sheet and attach it with an email list. First connecting is done with “sqlplus -s $FCP_LOGIN” in silent mode.Then EOF marks the begining of sql statement and another Read More

20November 2008

AWK syntax: awk [-Fs] “program” [file1 file2...] # commands come from DOS cmdline awk ‘program{print “foo”}’ file1 # single quotes around double quotes # NB: Don’t use single quotes alone if the embedded info will contain the # vertical bar Read More

18November 2008

You can easily install NTP (Network Time Protocol, a means of transmitting time signals over a computer network) using yum command under Redhat or CentOS/Fedora core Linux. Login as the root user Type the following command to install ntp # yum install ntp Turn on service # chkconfig ntpd Read More

16November 2008

#include <iostream> #include <string> using namespace std; void main() {         int max;         cin> > max;         if(max <= 0)         {       Read More

9November 2008

Q. How can I set the system date and time from the command prompt (bash shell)? I don’t have GUI installed and I am login over ssh session. A. Use date command to display the current date and time or set the system date and time over ssh session. This is useful if the Linux server time Read More

9November 2008

The best way is to use bash functions like this: I have made a function called fsc in  .bashrc meaning find scripts. I have developed many scripts in /root/work/scripts/dev directory. If wanted to find the script name providing a short name, here is the way. Usage: fsc deny #it will find all the Read More

8November 2008

If you’ve got a directory with dozens of zipped or rar’d files, you can run a single command to unzip them all in one step, thanks to the power of the bash shell. For this task, we’ll use bash’s for loop command structure. Replace with a variable name, and with either a command that Read More

4November 2008

My unix knowledge is very primitive. I am having difficulty to write shell script using which I can find new created files after some specific date time under specific folder…pls let me know if you know about this. You could try this. The following will give a list of files between 2 Read More

4November 2008

Many of us know how to burn a cd/dvd in windows or mac. Here is the way to burn the cd in linux. This is mostly tested in Redhat Linux 9 version and RHEL. This locker contains software that may be useful with CDR and CDRW drives.  Bug reports may be sent to bug-cdrecord@mit.edu. How to record a Read More

4November 2008

How to Manually setup Xfree from Xwindows This is to fix the dell laptop issue with xfree login as root load the RHAS3.0 disk 2 and copy all XFree*rpm to a directory rpm -Uvh –nodeps XFree86-100dpi-fonts-4.3.0-35.EL.i386.rpm XFree86-4.3.0-35.EL.i386.rpm Read More

4November 2008

Use the following steps to turn off sendmail permanently chkconfig –help chkconfig version 1.3.8 - Copyright (C) 1997-2000 Red Hat, Inc. This may be freely redistributed under the terms of the GNU Public License. usage:   chkconfig –list [name] chkconfig –add Read More

Next Page »