help removing some text from a file (sed)
I have a text file that looks something like this:
--------------------------- begin foo [good 89 98 89 8 78 76 56 56 8 ] "N" [bad 987 78 69 9 6 889 89 0 90 890 9 ] "other" [good 09890 7890 89 89 89 90 90 ] jkak asj --------------------------- I want to remove the stuff in bold. I've tried sed '/"N"/,/]/d', but it doesn't seem to work.... > sed '/"N"/,/]/d' tester begin I also tried this: > sed 's/"N".*]//g' tester begin foo [good 89 98 89 8 78 76 56 56 8 ] jkak asj ... but that doesn't stop at the first ']'. ideas? |
Try that one:
Code:
sed 's/"N" [^]]*]//' |
Quote:
Thanks! ... err... edit... if we modify the file a bit, this method stops working. i.e.: ---------------- begin foo [good 89 98 89 8 78 76 56 56 8 ] "N" [bad 987 78 69 9 6 889 89 0 90 890 9 ] "other" [good 09890 7890 89 89 89 90 90 ] jkak asj ----------------- it should work in either case. |
All times are GMT -5. The time now is 10:57 PM. |