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
    #1  
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
    #2  
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
    #3  
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.
    #4  
Old 04-01-2010
methyl methyl is offline Forum Advisor  
Advisor
 
Join Date: Mar 2008
Last Activity: 18 April 2014, 5:13 AM EDT
Posts: 6,396
Thanks: 287
Thanked 672 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
    #5  
Old 04-02-2010
drl's Avatar
drl drl is offline Forum Advisor  
Registered Voter
 
Join Date: Apr 2007
Last Activity: 30 July 2014, 8:39 AM EDT
Location: Saint Paul, MN USA / BSD, CentOS, Debian, OS X, Solaris
Posts: 1,663
Thanks: 34
Thanked 186 Times in 170 Posts
Hi.

If you would rather read from a book:

Code:
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: http://www.oreilly.com/catalog/sed2/index.html
Comments: tarball examples: http://examples.oreilly.com/sed2/

Best wishes ... cheers, drl
Sponsored Links
    #6  
Old 04-08-2010
chakrapani's Avatar
chakrapani chakrapani is offline
Registered User
 
Join Date: Sep 2009
Last Activity: 20 July 2014, 1:58 PM EDT
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
    #7  
Old 05-13-2010
Greco Greco is offline
Registered User
 
Join Date: May 2010
Last Activity: 2 July 2010, 7:22 AM EDT
Location: http://www.ashisoft.com
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 04:33 AM
SimpleAWK Examples unxusr123 UNIX for Dummies Questions & Answers 2 06-11-2008 01:31 AM
redhat-release examples BOFH Red Hat 5 03-23-2007 12:42 AM
need examples? wmosley2 Shell Programming and Scripting 1 12-14-2003 09:47 PM
looking for .profile examples JimC UNIX for Advanced & Expert Users 8 04-03-2002 02:38 PM



All times are GMT -4. The time now is 07:27 AM.