Grep Help Please

I would like to know what grep string i would need to auto remover the 2 lines of text that end in . and .. as is listed in my example text below.
the 2 lines i need to match and remove are

drwxr-xr-x 3 root wheel 102 Jan 21 05:16 .
drwxr-xr-x 30 root wheel 1020 Jan 21 19:15 ..

example code..........

./Frameworks/CoreMediaIO.framework/Versions/A/Resources/CMIOUnits.bundle/Contents/Resources/uk.lproj:
total 0
drwxr-xr-x   3 root  wheel   102 Jan 21 05:16 .
drwxr-xr-x  30 root  wheel  1020 Jan 21 19:15 ..
-rw-r--r--   1 root  wheel   458 Jan 21 05:16 CMIOUnit.strings

./Frameworks/CoreMediaIO.framework/Versions/A/Resources/CMIOUnits.bundle/Contents/Resources/zh_CN.lproj:
total 0
drwxr-xr-x   3 root  wheel   102 Jan 21 03:19 .
drwxr-xr-x  30 root  wheel  1020 Jan 21 19:15 ..
-rw-r--r--   1 root  wheel   338 Jan 24 15:33 CMIOUnit.strings

./Frameworks/CoreMediaIO.framework/Versions/A/Resources/CMIOUnits.bundle/Contents/Resources/zh_TW.lproj:
total 0
drwxr-xr-x   3 root  wheel   102 Jan 21 00:33 .
drwxr-xr-x  30 root  wheel  1020 Jan 21 19:15 ..
-rw-r--r--   1 root  wheel   362 Jan 24 15:33 CMIOUnit.strings

./Frameworks/CoreMediaIO.framework/Versions/A/Resources/CMIOUnits.bundle/Contents/_CodeSignature:
total 0
drwxr-xr-x  3 root  wheel   102 Jan 20 17:21 .
drwxr-xr-x  7 root  wheel   238 Jan 20 18:18 ..
-rw-r--r--  1 root  wheel  1678 Jan 21 19:32 CodeResources

Hello,

you can use the following command for same.

ls -ltr "check_2nd_column_max_value12111"
-rw-r--r--    1 singh singh1            77 Mar 17 20:16 check_2nd_column_max_value12111

Thanks,
R. Singh

Hey,
If want to remove . and .. , just grep like this:

grep -v '[[:blank:]]\{1,\}\.\{1,2\}$' example.text

I guess I should have said that I am using TextWrangler, and editor that has GREP Find/Replace feature.

How could this be used for my issue to replace those 2 lines of txt with blank space?

Hello,

Could you please use the following command for same.

awk '/^-/ {print}' check_specific_grep_data_patteren_check1212123

output will be as follows.

-rw-r--r-- 1 root wheel 458 Jan 21 05:16 CMIOUnit.strings
-rw-r--r-- 1 root wheel 338 Jan 24 15:33 CMIOUnit.strings
-rw-r--r-- 1 root wheel 362 Jan 24 15:33 CMIOUnit.strings
-rw-r--r-- 1 root wheel 1678 Jan 21 19:32 CodeResources

Where input file is check_specific_grep_data_patteren_check1212123 with following text in it.

 cat check_specific_grep_data_patteren_check1212123
./Frameworks/CoreMediaIO.framework/Versions/A/Resources/CMIOUnits.bundle/Contents/Resources/uk.lproj:
total 0
drwxr-xr-x 3 root wheel 102 Jan 21 05:16 .
drwxr-xr-x 30 root wheel 1020 Jan 21 19:15 ..
-rw-r--r-- 1 root wheel 458 Jan 21 05:16 CMIOUnit.strings
./Frameworks/CoreMediaIO.framework/Versions/A/Resources/CMIOUnits.bundle/Contents/Resources/zh_CN.lproj:
total 0
drwxr-xr-x 3 root wheel 102 Jan 21 03:19 .
drwxr-xr-x 30 root wheel 1020 Jan 21 19:15 ..
-rw-r--r-- 1 root wheel 338 Jan 24 15:33 CMIOUnit.strings
./Frameworks/CoreMediaIO.framework/Versions/A/Resources/CMIOUnits.bundle/Contents/Resources/zh_TW.lproj:
total 0
drwxr-xr-x 3 root wheel 102 Jan 21 00:33 .
drwxr-xr-x 30 root wheel 1020 Jan 21 19:15 ..
-rw-r--r-- 1 root wheel 362 Jan 24 15:33 CMIOUnit.strings
./Frameworks/CoreMediaIO.framework/Versions/A/Resources/CMIOUnits.bundle/Contents/_CodeSignature:
total 0
drwxr-xr-x 3 root wheel 102 Jan 20 17:21 .
drwxr-xr-x 7 root wheel 238 Jan 20 18:18 ..
-rw-r--r-- 1 root wheel 1678 Jan 21 19:32 CodeResources

Thanks,
R. Singh

Looks like "textwrangler" uses "PCRE" as the regular expression engine, so try this expression:

.*\.{1,2}$

Do questions:-

  1. Have your run ls -lR or similar?
  2. Are you wanting to list the files only?

if the answer is yes to both, then convert your command to a find like this:-

find . -type f -exec ls -l {} +

If + is not supported, use \; instead.

If all the files you are after are down ./Frameworks/CoreMediaIO.framework/Versions and below, you can put that in your find if you wish:-

find ./Frameworks/CoreMediaIO.framework/Versions -type f -exec ls -l {} +

.... which will exclude other directories.

I hope that this helps, but let me know if i have missed the point.

Robin
Liverpool/Blackburn
UK