Showing posts with label shell. Show all posts
Showing posts with label shell. Show all posts
Thursday, December 13, 2012
grep for multiple strings
command:
grep "string1\|string2\|string3"
Tuesday, November 20, 2012
sed search lines and comment out or uncomment
comment out..
sed '/pattern/s/^/#/'
uncomment out...
sed '/pattern/s/^/# *//'
Thursday, July 12, 2012
shell IF statements
shell script, IF evaluate conditions:
Expression | Description |
-d file | True if file is a directory. |
-e file | True if file exists. |
-f file | True if file exists and is a regular file. |
-L file | True if file is a symbolic link. |
-r file | True if file is a file readable by you. |
-w file | True if file is a file writable by you. |
-x file | True if file is a file executable by you. |
file1 -nt file2 | True if file1 is newer than (according to modification time) file2 |
file1 -ot file2 | True if file1 is older than file2 |
-z string | True if string is empty. |
-n string | True if string is not empty. |
string1 = string2 | True if string1 equals string2. |
string1 != string2 | True if string1 does not equal string2. |
Subscribe to:
Posts (Atom)