LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   unixs shell commands (https://www.linuxquestions.org/questions/programming-9/unixs-shell-commands-241748/)

djgerbavore 10-12-2004 11:03 AM

unixs shell commands
 
are sed and grep, type of perl scripts??? As learning perl i noticed alot of similarity between perl's reg. exprs and sed and grep commands. I think i'm having an epiphany..hahah

i typed man grep | grep "perl" and found that (i think?) it uses perl regexp...
just wanted to know,

perl seems to be a pretty neat language to learn. However some of its commands and syntax are little confusing at times.

mirradric 10-12-2004 11:13 AM

just because something uses regular expression doesn't mean that it is in perl. In fact, regular expressions are used by many other tools and languages, like java...

AnanthaP 10-12-2004 11:14 AM

Nope. perl is a type of script probably based on sed and grep which have been around since 1969 or so (when Unix was written).

The GNU version of these probably from around the time Linux came into the picture.

An extract (unedited) from the Jargon File is reproduced below:
PERL
[Practical Extraction and Report Language, a.k.a. Pathologically Eclectic Rubbish Lister] An interpreted language developed by Larry Wall, author of patch(1) and rn(1)). Superficially resembles awk, but is much hairier, including many facilities reminiscent of sed(1) and shells and a comprehensive Unix system-call interface.

And now "regexp" from the same source.
Common written and spoken abbreviation for regular expression, one of the wildcard patterns used, e.g., by Unix utilities such as grep(1), sed(1), and awk(1). These use conventions similar to but more elaborate than those described under glob. ... it is sufficient to note that regexps also allow complemented character sets using ^; thus, one can specify ‘any non-alphabetic character’ with [^A-Za-z].

End

avarus 10-12-2004 12:12 PM

As previous posters have said, Perl came much later than the venerable 'sed' and 'grep'. However, the regex syntax in Perl 5 is very powerful and has thus been incorporated into recent GNU versions of these tools (eg. compare grep with egrep).

You can now find support for 'Perl Compatible Regular Expressions' (PCREs) for just about any language (eg Java, C) via addon libraries, but this does not mean the programs actually contain any Perl.

TIM


All times are GMT -5. The time now is 09:39 AM.