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 do you change file permissions and ownership in Unix?

2 Answers  


What does find command return in unix?

0 Answers  


Name the various commands that are used for the user information in unix.

0 Answers  


Is there any method to erase all files in the current directory, along with its all sub-directories, by using only one command?

0 Answers  


distinguish between multi-tasking,multi-user,multi- processing and time sharing?

7 Answers   Alcatel, Cisco, Infosys, University Exams,


Can a process kill itself in UNIX/or in its various versions?

2 Answers  


What Is the command to change a file's creation time. means one file is created at the time 15:19 then time should br changed to 14:14

8 Answers   3i Infotech, IBM,


what is the default permission for /etc/shadow file in UNIX

2 Answers   Wipro,


What do chmod, chown, chgrp commands do?

0 Answers  


How can you see the command line history?

0 Answers  


How do you move a process which is running background to foreground?

9 Answers  


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?

7 Answers  


Categories