What is the difference between AWK and SED commands? Plz
give example and explain...

Answers were Sorted based on User's Feedback



What is the difference between AWK and SED commands? Plz give example and explain.....

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

What is the difference between AWK and SED commands? Plz give example and explain.....

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 is the difference between AWK and SED commands? Plz give example and explain.....

Answer / eyghbf

e56f td

Is This Answer Correct ?    6 Yes 7 No

Post New Answer

More Unix Commands Interview Questions

How can we "forked" process in UNIX? How then recognize in any of the branches we?

2 Answers   NIIT,


How to get the last ten lines of a file using awk utility?

1 Answers   Infosys,


What is awk used for?

0 Answers  


which command is used to identify the type of the file?

3 Answers  


How does the system know where one command ends and another begins?

0 Answers  






What command would users use to see what file one page at a time in UNIX?

7 Answers   IBM,


what is the shell for dos,nt operating systems?

1 Answers  


Explain mount and unmount command.

0 Answers  


Is there a way to erase all files in the current directory, including all its sub-directories, using only one command?

0 Answers  


How to copy multiple files and directories into some other directory?

4 Answers  


What does the metacharacter mean?

0 Answers  


distinguish between interrupts and exceptions?

2 Answers   Infosys,


Categories