- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Which came first, the sed & awk or the Perl?
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-02-2003 11:21 AM
07-02-2003 11:21 AM
Actually, one other question. I have Cygwin on my laptop and can practice scripting at home. Will I find the Cygwin versions of sed/awk/perl to be different than the HP-UX releases? (extra pts for this one)
Any thoughts are appreciated....
Jim Mallett
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-02-2003 11:30 AM
07-02-2003 11:30 AM
Re: Which came first, the sed & awk or the Perl?
I've been doing shell scripting in one form or fashion for nearly 20 years, and I'm still learning stuff. Open in front of me on the desk I type this are 3 O'Reilly books: _Learning Perl_, _Effective Awk Programming_, and _Mastering Regular Expresssions_.
These are all complementary, not competing. They work together quite well. I really know nothing of PERL, but am learning. Sed & awk are what I use most commonly, but awk is a programming language all by itself. Generally, PERL is considered a superset of awk.
Most importantly: LOTS of coffee, followed by beer.
Chris
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-02-2003 11:35 AM
07-02-2003 11:35 AM
SolutionBoth are good BUT if I were starting over, I would go only with Perl. There is really nothing you can do with sed, awk, sort, grep, sh, ... that you can't do with Perl directly. The price you pay is that the learning curve is steeper but the regular expressions in Perl are on steroids. If you learn Perl RE's first then some of the things can't be applied to sed or awk.
About the only thing I turn to awk first for is simple one-liners that print maybe the 3rd and 5th field of each line. Awk is a little simpler for tasks like that but Perl is really the weapon of choice these days.
In a very real sense, the only need for awk/sed knowledge is to fix/maintain legacy code. All of my new scripting is Perl and as a bonus if carefully written will run platform independently -- and not just UNIX.
Your Cygwin versions will be close enough. There will be minor awk differences and basically Perl 5.6 is Perl 5.6 but Perl will have modules that are OS/Platform specific but those are not the typical day-to-day Perl tasks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-02-2003 11:37 AM
07-02-2003 11:37 AM
Re: Which came first, the sed & awk or the Perl?
If you master perl, then sed & awk will be that much easier.
regards
Tim
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-02-2003 11:37 AM
07-02-2003 11:37 AM
Re: Which came first, the sed & awk or the Perl?
Sed and awk were made shortly after UNIX was invented.
If you learn Perl, you may not need anything else.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-02-2003 11:38 AM
07-02-2003 11:38 AM
Re: Which came first, the sed & awk or the Perl?
If you want to be good in system then
you should learn every thing!
Perl is the best, you can do with what ever
you want.
Sed&Awk give you the power in the command line.
About the coffee so if you know programing
(line C, pascal, etc.) then it would be hard
so not to much coffee if not then you will need
more coffee.
I know that perl in hpux (unix kind) a little
diffrent than in win systems, more function
you have on unix, but for basic programming
you would see a diffrent.
Search on the net for book by O'really
you will find good books about perl, sed & awk
Caesar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-02-2003 11:41 AM
07-02-2003 11:41 AM
Re: Which came first, the sed & awk or the Perl?
Now that that's overwith, here is what you need to master before handling any of the 3. Regular expressions!
sed, awk, and perl all use the same exact regular expressions. If you can master in 1, you can master in all. Since sed is the fastest way to test your regular expressions, get the knack for them here.
Now for programming, if I went back in time I would have dont alot more of my work in Perl. Sadly, perl is not available for at the same level for all Unices, and I work on many. IMHO it would have been worth it to compile it for each and use it.
As for practicing on your laptop with cygwin, the sed, awk and perl work the same. However remember that the base OS is still windblows, so critical things you could do in Unix just can not possibly exist.
Regards,
Shannon
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-02-2003 11:46 AM
07-02-2003 11:46 AM
Re: Which came first, the sed & awk or the Perl?
Perl.
Study alot of Perl.
You can market Perl on your resume. SED and AWK are mostly obsolete.
Here's what you need to know about awk:
cat file | awk '{ print $0 $1 $2 $3 }'
That's it!
Here what you need to know about sed:
VAR=$(echo $PATH | sed -e -s "/\// /g" )
That's it!
Everything else can be done faster and more efficiently in perl. And if you want to learn then copy and apply everything from this thread:
http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0x026250011d20d6118ff40090279cd0f9,00.html
Those books might be good for reference but don't read them cover to cover.
Also, get a 4mm tape and start tar'ing all of your scripts onto tape so you always have them.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-02-2003 12:16 PM
07-02-2003 12:16 PM
Re: Which came first, the sed & awk or the Perl?
There may be one important reason why also learn something about awk and sed. You will find awk and sed on all Unix boxes but perhaps not Perl (and you are perhaps not allowed to install it everywhere). The same reason why it is important to know something about vi, it is always avialable.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-02-2003 01:24 PM
07-02-2003 01:24 PM
Re: Which came first, the sed & awk or the Perl?
As previously stated it doesn't hurt to learn all of them. Yes they do lend to each other in
some regards such as their support of regular expressions.
For the final piece of the question there are some minor differences in the behavior and how it processes certain types of information between the Cygwin versions of sed and awk and the HP-UX versions. Perl should be the same for both.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-02-2003 03:06 PM
07-02-2003 03:06 PM
Re: Which came first, the sed & awk or the Perl?
I think it depends what you are likely to be exposed to on a regular basis and how you think; Perl is obviously the up-and-coming environment, but I find awk and sed suit my programming style and experience (4GLs, old 80's programming training, COBOL, etc).
Ask yourself this question, which of these loops would be the way you would mentally structure the problem?
Answer A:
While not EOF
Read from File
count++
End Loop
Print Count
Answer B:
Print File, pass to a function that counts the lines and prints the result
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
Answer A:- Use Perl
Answer B:- Use awk / sed
I will try to come up with a better test and will post it later. Share and Enjoy! Ian
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-02-2003 03:31 PM
07-02-2003 03:31 PM
Re: Which came first, the sed & awk or the Perl?
I'll be trying to read perl book(O reilly) starting from last week but no avail.By starting looking at the book, is as though as taking a sleeping pil.
Tip:Get a lot of coffee...
regards
mB
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-02-2003 09:08 PM
07-02-2003 09:08 PM
Re: Which came first, the sed & awk or the Perl?
I'm going to go with the Perl first because I still do a lot of Windowz work and I like the idea of it being cross-platform.
For all in the States, have a Happy 4th! For all that aren't, I guess have a Happy 4th without the fireworks.
Jim
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-03-2003 04:03 AM
07-03-2003 04:03 AM
Re: Which came first, the sed & awk or the Perl?
The big problem I have with Perl is that is is write-only, especially the REs. It is so powerful that scripters get carried away and can generate complex code that may have been obvious to them at the time are completely incomprehensible to anyone else.
sh, awk, sed etc may have less power and take longer to write (and run), but readability is something I have never had a problem with.
BTW don't forget us in the UK when dishing out points. Being to your East we generally don't get to post replies until the day after, by which time all the easy points habe been scooped up ;-(
-- Graham
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-03-2003 04:22 AM
07-03-2003 04:22 AM
Re: Which came first, the sed & awk or the Perl?
I missed the bandwagon. Hope to join late will not be punished.
My idea is to start with sed and awk first. That will give an edge with the shell script background. Oneliners will come in handy as always. Master regular expressions also. Get Oreilly Mastering regular expressions also. You can move ahead in Perl quicky if you have these basics. Actually you can concentrated on Perls richness. A lot of coffee is needed (I drink tea).
Good with cygwin. Cygwin is where I actually learnt all these stuff. Learning and doing some samples wont be a problem in cygwin environment. As also you can update the cygwin to the latest one. The trick will be the usage of regular expressions. If we master that then done.
All the best for a successful weekend. (Get the camel at the end. But you need to practise before reaching there.)
cheers
Umapathy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-03-2003 04:30 AM
07-03-2003 04:30 AM
Re: Which came first, the sed & awk or the Perl?
There is a one liner contest where you have to make it as hard to understand as possible while doing something worthwhile.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-03-2003 04:45 AM
07-03-2003 04:45 AM
Re: Which came first, the sed & awk or the Perl?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-03-2003 05:52 AM
07-03-2003 05:52 AM
Re: Which came first, the sed & awk or the Perl?
Why?
You have all the modules you need at www.cpan.org. EVERYTHING.
Modules for databases, for networking , even to emulate a subset of expect.
It's a glue languaje. That means you can use it to comunicate in some way betwen apps.
You can do CGIs.
Emulate ASPs.
Any trouble you can have, perl has a solution to it. Easy (well... most of the times).
If someday you need something of awk or sed, you can use:
# my_command | perl -ne 'you litle script here'.
And don't even think about it.
Learn Perl, and learn it well.
I've been developing Network Management Apps for 4 years. Perl always has been the solution of all my headaches.