Awk and Sed examples | Unix Linux Forums | Emergency UNIX and Linux Support

  Go Back    

Emergency UNIX and Linux Support Please post your urgent questions here for highest visibility. Posting a new thread to this forum requires Bits. We monitor this forum to help people with emergencies, but we do not guarantee response time or answers. This forum is "best effort" only. Members who reply to posts here receive a bonus of 1000 Bits per reply.

Awk and Sed examples

Emergency UNIX and Linux Support

Closed Thread    
Thread Tools Search this Thread Display Modes
Old 03-30-2010
j_panky j_panky is offline
Registered User
Join Date: Mar 2010
Last Activity: 27 October 2011, 12:00 AM EDT
Posts: 93
Thanks: 0
Thanked 0 Times in 0 Posts
Awk and Sed examples

Hi all,
I tried to understand what this awk and sed does but cudnt understand.

Can any body explain what awk and sed means with one simple example each and complex examples each with explanation.

Thanks in advance.
Sponsored Links
Old 03-30-2010
malcomex999 malcomex999 is offline
Registered User
Join Date: Sep 2008
Last Activity: 8 December 2013, 3:25 AM EST
Location: In the beautiful World...
Posts: 509
Thanks: 9
Thanked 28 Times in 28 Posts
Google should your best friend to answer this!!!
And you were not suppose to put it in emergency forum...
Sponsored Links
Old 04-01-2010
dmacpherson dmacpherson is offline
Registered User
Join Date: Apr 2010
Last Activity: 1 April 2010, 2:46 PM EDT
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
One of the best AWK pages that I've seen is Bruce Barnett's page for awk:

Awk - A Tutorial and Introduction - by Bruce Barnett

He also maintains an excellent page for sed:

Sed - An Introduction and Tutorial

Other good resources include:

The GNU Awk User's Guide (Man pages for GNU awk, assuming that you're using Linux, or have Linux packages installed)

sed, a stream editor

Happy hunting.
Old 04-01-2010
methyl methyl is offline Forum Advisor  
Join Date: Mar 2008
Last Activity: 26 December 2014, 10:07 PM EST
Posts: 6,396
Thanks: 287
Thanked 673 Times in 642 Posts
Of the many collections of "sed" examples this contains simple and complex examples which have practical uses. Not verified. Always test on expendable test data files.

sed one-liners
Sponsored Links
Old 04-02-2010
drl's Avatar
drl drl is offline Forum Advisor  
Registered Voter
Join Date: Apr 2007
Last Activity: 1 February 2015, 7:08 AM EST
Location: Saint Paul, MN USA / BSD, CentOS, Debian, OS X, Solaris
Posts: 1,722
Thanks: 49
Thanked 212 Times in 192 Posts

If you would rather read from a book:

Title: sed & awk
Author: Dale Dougherty, Arnold Robbins
Edition: 2nd
Date: March 1997
Publisher: O'Reilly
ISBN: 1-56592-225-5
Pages: 432
Categories: text, editing, utilities, scripting, programming
Comments: tarball examples:

Best wishes ... cheers, drl
Sponsored Links
Old 04-08-2010
chakrapani's Avatar
chakrapani chakrapani is offline
Registered User
Join Date: Sep 2009
Last Activity: 14 November 2014, 3:15 PM EST
Location: Asia
Posts: 178
Thanks: 0
Thanked 6 Times in 5 Posts
sed = stream line editor ... Basically read a line/word/character and apply changes and send to screen STDOUT ( most of time).

awk = more of programming language can be easier to write compared to sed

if you are looking to answer an interview question then you need to practice a bit on each. or if you are writing one liner's .... try searching web.
Sponsored Links
Old 05-13-2010
Greco Greco is offline
Registered User
Join Date: May 2010
Last Activity: 2 July 2010, 7:22 AM EDT
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Google it and you will find the correct asnwer!
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
comprehensive expect examples ppucci Shell Programming and Scripting 1 09-25-2009 05:33 AM
SimpleAWK Examples unxusr123 UNIX for Dummies Questions & Answers 2 06-11-2008 02:31 AM
redhat-release examples BOFH Red Hat 5 03-23-2007 01:42 AM
need examples? wmosley2 Shell Programming and Scripting 1 12-14-2003 10:47 PM
looking for .profile examples JimC UNIX for Advanced & Expert Users 8 04-03-2002 03:38 PM

All times are GMT -4. The time now is 12:38 PM.