Thursday 25 August 2016

Shell scripting


What is the difference between $* and $@?

Unquoted, there is no difference -- they're expanded to all the arguments and they're split accordingly.
The difference comes when quoting. "$@" expands to properly quoted arguments and "$*" makes all arguments into a single argument.

What is the significance of $#?
The number of arguments supplied to a script.

sed stands for stream editor is a stream oriented editor.
It receives text input, whether from stdin or from a file, performs certain operations on specified lines of the input, one line at a time, then outputs the result to stdout or to a file.
'2,5!d'
This will deleted everything except starting from 2nd till 5th line.
'1~3d'
This deletes the first line, steps over the next three lines, and then deletes the fourth line. Sed continues applying this pattern until the end of the file.

Awk
Pattern scanning and processing language
Cmp
Compare the contents of two files
Comm.
Compare sorted data
Cut
Cut out selected fields of each line of a file
Diff
Differential file comparator
Expand
Expand tabs to spaces
Join
Join files on some common field
Perl
Data manipulation language
Sed
Stream text editor
Sort
Sort file data
Split
Split file into smaller files
Tr
Translate characters
Uniq
Report repeated lines in a file
Wc
Count words, lines, and characters



No comments:

Post a Comment