Wednesday, January 19, 2011

sed - Include or Append a line to a file

 sed is one of the most important editors we use in UNIX. It supports lot of file editing tasks. In this article, we will see a specific set of sed options.

Assume I have a flat file, empFile, containing employee name and employee id as shown below:
Hilesh, 1001
Bharti, 1002
Aparna, 1003
Harshal, 1004
Keyur, 1005

Tuesday, January 11, 2011

Positional parameters in a shell script

 Positional parameters in a shell script are nothing but the command line arguments passed to a shell script. The following are some of the positional parameters used:
$# -  Total number of arguments
$0 - Command or the script name
$1,$2, $3 - First, second and third args respectively.
$* - All the command line arguments starting from $1.