Results 1 to 6 of 6

Thread: unix

  1. #1
    Junior Member
    Join Date
    Sep 2008
    Answers
    2

    unix

    what is the main difference between grep and sed ,


  2. #2
    Junior Member
    Join Date
    Sep 2008
    Answers
    2

    Re: unix

    what is the main diffrence between grep and sed


  3. #3

    Re: unix

    we need grep for one word searching,but sed for stream of words thats y it is called stream editor


  4. #4

    what is the main difference between grep and sed ,

    You can use the sed command to change all occurrences of one string to another within a file, just like the search-and-replace feature of your word processor. The sed command can also delete a range of lines from a file. Since sed is a stream editor, it takes the file given as input, and sends the output to the screen, unless you redirect output to a file. In other words, sed does not change the input file.

    Ex:
    Mary had a little ham

    sed 's/lamb/ham/g' poem.txt

    s=substitute
    g=global change(optional)


    Grep:
    If you want to search particular word or string in a file, you can use Grep command.
    Ex: grep -i had poem.txt
    -i=upper or lower letter(optional)




  5. #5
    Expert Member
    Join Date
    Dec 2007
    Answers
    138

    Re: unix

    HI friend,
    above answers are perfect , and i want to add few points.
    Grep command:
    This command will search for a string/text in specified file. syntax for the same is

    grep -<switches> <pattern> <FileName>

    there are number of switches availbale for this command.


    SED : It is an editor but non interactive .

    ex : # sed -e 'd/chain/dog/f' raja > shekar


  6. #6
    Expert Member
    Join Date
    Dec 2007
    Answers
    138

    Re: unix

    HI friend,
    above answers are perfect , and i want to add few points.
    Grep command:
    This command will search for a string/text in specified file. syntax for the same is

    grep -<switches> <pattern> <FileName>

    there are number of switches availbale for this command.


    SED : It is an editor but non interactive .

    ex : # sed -e 'd/chain/dog/f' raja > shekar


  7.  Sponsored Ads
    Ad


     

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
Applying for a job can be a stressful and frustrating experience, especially for someone who has never done it before. Considering that you are competing for the position with a at least a dozen other applicants, it is imperative that you thoroughly prepare for the job interview, in order to stand a good chance of getting hired. That's where GeekInterview can help.
Interact