What is the difference between AWK and SED commands? Plz
give example and explain...
Answers were Sorted based on User's Feedback
Answer / chets
SED (which stands for Stream EDitor) is a simple but
powerful computer program used to apply various
pre-specified textual transformations to a sequential stream
of text data.
It reads input files line by line, edits each line according
to rules specified in its simple language (the sed script),
and then outputs the line.
AWK is a complete pattern scanning and processing language,
it is most commonly used as a Unix command-line filter to
reformat the output of other commands.
For example, to print only the second and sixth fields of
the date command (the month and year) with a space
separating them, at the Unix prompt, you would enter:
date | awk ‘{print $2 ” ” $6}’
Is This Answer Correct ? | 80 Yes | 12 No |
Answer / sreenivas
sed reads from standard input and/or file(s), applies specified
changes which are typically mostly editing changes, and
writes to
standard output. It is relatively similar to the text editor
ed(1),
except in the case of sed it doesn't alter its input
file(s)*, but
writes the data to standard output, and sed also has some
commands
which ed does not have (and in most cases wouldn't be
suitable for or
make sense for ed). sed's commands are mostly limited to editing
type commands.
awk is sort of like an interpreted somewhat C-like language with
added built-in functionality for dealing with strings and
patterns.
Though not a fully general purpose programming language, awk
is much
closer to such than sed.
Is This Answer Correct ? | 22 Yes | 9 No |
what do you understand by 'building block primitive'?
What is command substitution?
1-how will you display a file whose name is starting with '- '? 2-how will you add a patten at end of every line in vi editor?
Which command is used to kill the last background job?
how will you convert a general file to a hidden file?
Explain iostat, vmstat and netstat.
can we use cat command as an editor ..???
What does the metacharacter mean?
Explain the read, write, and execute permissions on a UNIX directory.
what is the advaantage of each user having its own copy of the shell?
0 Answers BMC, CNS, DELL, Infosys,
distinguish between interrupts and exceptions?
What is the unix command to confirm a remote host is alive or not?