Difference between pages "TroubleShooting network" and "Grep"

From Linuxintro
(Difference between pages)
imported>ThorstenStaerk
 
imported>ThorstenStaerk
 
Line 1: Line 1:
This article describes what you can do if you have network problems. We will first identify the problem and then solve it.
+
* Show all lines that do '''not''' contain blabla
 +
grep -v blabla filename.txt
  
= Do you have an IP address =
+
* Match any character
Find out if you have an IP address
+
With a dot (.) you can match any character
  ip addr
+
  grep -E "L.nux"
If you do not have an IP address, fix this problem before proceeding.
+
Matches Linux, Lanux L nux, but not Lnux
  
We assume your IP address is 192.168.0.2
+
* Match all characters
 +
With a .* you can match an arbitrary count of any character
 +
grep -E "L.*nux"
 +
Matches Linux, Liinux, Lanux, L nux and Lnux
  
= Can you reach your computer =
+
* Match any character but blank
Find out if you can reach your own computer
+
  grep -E "L[^ ]nux"
  ping 192.168.0.2
+
Match Linux, Lanux, but not Lnux and not L nux
 
 
= Do you have a standard gateway =
 
Find out with
 
route
 
  
 
= See also =
 
= See also =
* [[TroubleShooting]]
+
* [[regex]]
* [[NetWork]]
 

Revision as of 08:58, 12 May 2009

  • Show all lines that do not contain blabla
grep -v blabla filename.txt
  • Match any character

With a dot (.) you can match any character

grep -E "L.nux"

Matches Linux, Lanux L nux, but not Lnux

  • Match all characters

With a .* you can match an arbitrary count of any character

grep -E "L.*nux"

Matches Linux, Liinux, Lanux, L nux and Lnux

  • Match any character but blank
grep -E "L[^ ]nux"

Match Linux, Lanux, but not Lnux and not L nux

See also