LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Closed Thread
 
Search this Thread
Old 12-29-2005, 06:13 AM   #1
minil
Member
 
Registered: Dec 2004
Location: Bangalore, India
Distribution: Fedora 2
Posts: 74

Rep: Reputation: 15
Need Grep command for the following output


Hi
i need grep command for the following output.
I have a file. as given below

Code:
#192.168.48.155
10.0.0.4
       #11.0.0.1

#239.0.01
       #12.1.0.1
        192.168.48.172
192.168.48.100

#192.158.32.0
Questions as follows
  1. To print lines which starts with # character.(# as first character : no need of space & then #character). Output should be(Idont want blank lines)
    Code:
    #192.168.48.155
    #239.0.01
    #192.158.32.0
    
    Code:
  2. To print lines which with # character as first character in line and also line with any number of space followed by #character. output should be.(I dont want blank lines)
#192.168.48.155 #11.0.0.1 #239.0.01 #12.1.0.1 #192.158.32.0
  • To print lines which starts with any number of space character followed by # as first . Output should be as follows
    Code:
         #11.0.0.1
         #12.1.0.1
  • To print lines which contains space followed by any characters.
    Code:
    
    
    #11.0.0.1
    192.168.48.172
    #12.1.0.1
  • .

    Its urgent..
    Thanks in advance.
     
    Old 12-29-2005, 06:51 AM   #2
    druuna
    LQ Veteran
     
    Registered: Sep 2003
    Posts: 10,532
    Blog Entries: 7

    Rep: Reputation: 2371Reputation: 2371Reputation: 2371Reputation: 2371Reputation: 2371Reputation: 2371Reputation: 2371Reputation: 2371Reputation: 2371Reputation: 2371Reputation: 2371
    Please do not crosspost.

    Answer is in other post.
     
      


    Closed Thread


    Thread Tools Search this Thread
    Search this Thread:

    Advanced Search

    Posting Rules
    You may not post new threads
    You may not post replies
    You may not post attachments
    You may not edit your posts

    BB code is On
    Smilies are On
    [IMG] code is Off
    HTML code is Off


    Similar Threads
    Thread Thread Starter Forum Replies Last Post
    output to a file - cat? grep? Godsmacker777 Linux - Newbie 6 12-08-2004 10:06 AM
    utf , standard output / input and grep too Fascistchicken Linux - Software 2 11-05-2004 08:52 AM
    sort grep output wijnands Linux - Newbie 4 10-09-2004 07:14 AM
    trying to figure out some output from grep naijaguy Linux - Newbie 8 08-17-2004 12:44 PM
    How can I filter the output of grep to exclude certain cases? QtCoder Linux - General 1 03-28-2004 12:05 AM


    All times are GMT -5. The time now is 09:33 PM.

    Main Menu
    My LQ
    Write for LQ
    LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
    Main Menu
    Syndicate
    RSS1  Latest Threads
    RSS1  LQ News
    Twitter: @linuxquestions
    identi.ca: @linuxquestions
    Facebook: linuxquestions Google+: linuxquestions
    Open Source Consulting | Domain Registration