Quote:
Originally Posted by minil
Questions as follows[list][*] To print lines which starts with # character.(# as first character .No space shoule be there #character). Output should be(Idont want blank lines.
Code:
#192.168.48.155
#239.0.01
#192.158.32.0
|
grep "^#" <infile>
Quote:
[*]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.
Code:
#192.168.48.155
#11.0.0.1
#239.0.01
#12.1.0.1
#192.158.32.0
|
grep "^[ ]*#" <infile> (between the square brackets are a space and a tab)
Quote:
[*]To print lines which starts only with space character followed by # as first . Output should be as follows
Code:
#11.0.0.1
#12.1.0.1
|
grep "^[ ][ ]*#" <infile> (again, space and tab between the square brackets)
Quote:
[*]To print lines which contains space followed by any characters
Code:
#11.0.0.1
192.168.48.172
#12.1.0.1
|
grep "^[ ][ ]*" <infile> (again, space and tab between the square brackets)
Hope this helps.