Monday, June 22, 2009

UNIX script Q

Long time since any here is one for all of you who would love to do some unix questions...
  • I have a file pattern.txt and another file lines.txt. I want the list of all lines in lines.txt that match any pattern in pattern.txt
The command maybe simple to all of you
grep -f pattern.txt lines.txt

  • Here I want the list of all lines in fileA but not in fileB
sort fileA fileB| uniq -u

  • Kill all processes by a user
kill -9 `ps -u -o "pid="`
  • List all files modified last week
find / -mtime -7 -print
+7 will give you more than a week ago

Thanking you,

No comments:

Post a Comment