mercredi 8 avril 2015

grep not extracting desired string

I'm working on the following question for my class (in Unix) and I'm running into some problems.



  1. Using the grep command and regular expressions, create a pipe-based chain of commands that will list all files in the default directory that others can read or write.


this is the command I have so far and it will correctly match the right lines, but I only want to to print the name of the file that has the desired permissions.



ls -la | grep "^.......rw.*:\d\d\s(.*)$"


here is the result of just typing ls -la by the way which is what I'm "greping"



total 344
drwxr-xr-x 10 cameronpattisall staff 340 Apr 7 11:21 .
drwxr-xr-x 7 cameronpattisall staff 238 Apr 7 11:22 ..
-rw-r--r-- 1 cameronpattisall staff 6148 Apr 7 11:21 .DS_Store
-rw-r--r-- 1 cameronpattisall staff 11591 Apr 7 11:21 DifferencesToTagged.txt
-rw-r--r-- 1 cameronpattisall staff 4291 Apr 7 11:21 functions.py
-rw-r--r-- 1 cameronpattisall staff 6080 Apr 7 11:21 ls.txt
-rw-r--r-- 1 cameronpattisall staff 5511 Apr 7 11:21 prog4.py
-rw-r--r-- 1 cameronpattisall staff 345 Apr 7 11:21 shared.py
-rw-r--r-- 1 cameronpattisall staff 1832 Apr 7 11:21 subversion-log.txt
-rw-r--r-- 1 cameronpattisall staff 122295 Apr 7 11:21 testcases.txt

Aucun commentaire:

Enregistrer un commentaire