سؤال

أهدف إلى الحصول على قائمة من الخطوط حيث يمكنني استخدام Word NB في ملاحظاتي.

كود مزيف

open -a Firefox `ack -a NB`

ومع ذلك، لا يمكنني جعل فايرفوكس لفهم المعلمات من المحطة. إخراج ACK هو ملف نصي، لذلك يجب إعادة توجيهها بطريقة ما إلى Firefox.

أنا دون جدوى

open "http://`ack -a NB`"

أحصل على شريط عنوان فايرفوكس

http://[1/;32mACK-grep/.todo%1B%5B0m:3:%20%20%20%20%20%20%20%20to%20find%20%1B%5B30;43mNB%1B%5B0ms%20use%20ack%20-a%20%1B%5B30;43mNB%1B%5B0m%1B%5B0m%1B%5BK%0A%1B%5B1;32mAPI/.todo%1B%5B0m:5:%20%20%20%20%20%20%20%20%20%20%20%20%1B%5B30;43mNB%1B%5B0m%1B%5B0m%1B%5BK%0A%1B%5B1;32mAWK/.todo%1B%5B0m:5:%20%20%20%20%20%20%20%20%20%20%20%20Changing%20the%20field%20separator.%20%1B%5B30;43mNB%1B%5B0m%20do%20non%20confuse%20the%20field%20separator%20to%20small%20f%20i.e.%20-f%20for%20the%20name%20of%20a%20script%20file%1B%5B0m%1B%5BK%0A%1B%5B1;32mBg-disown/.todo%1B%5B0m:12:%1B%5B30;43mNB%1B%5B0m%20disowning%20is%20a%20one%20way%20street.%20There%20is%20no%20way%20to%20reattach%20as%20with%20screen.%1B%5B0m%1B%5BK%0A%1B%5B1;32mC-C++/Getting-started/.todo%1B%5B0m:6:%1B%5B30;43mNB%1B%5B0m%20endl%20indicates%20line%20output.%1B%5B0m%1B%5BK%0A%1B%5B1;32mC-C++/Getting-started/.todo%1B%5B0m:38:%1B%5B30;43mNB%1B%5B0m%20stdexcept%20allows%20standard%20exceptions%1B%5B0m%1B%5BK%0A%1B%5B1;32mC-C++/Getting-started/.todo%1B%5B0m:45:%20%20%20%20%20%20%20%20%20%20%20%20%1B%5B30;43mNB%1B%5B0m%20ensure%20that%20the%20user%27s%20given%20value%20is%20not%20eg%20string%20when%20the%20program%20wants%20a%20figure%1B%5B0m%1B%5BK%0A%1B%5B1;32mC-C++/Getting-started/.todo%1B%5B0m:63:%20%20%20%20%20%20%20%20%20%20%20%20%1B%5B30;43mNB%1B%5B0m%20&num%20is%20same%20as%20num&%1B%5B0m%1B%5BK%0A%1B%5B1;32mC-C++/Special-facts/.todo%1B%5B0m:3:%20%20%20%20%20%20%20%20%1B%5B30;43mNB%1B%5B0m%20**in%20C++:%20http://stackoverflow.com/questions/644981/what-is-in-c/644989%23644989%1B%5B0m%1B%5BK%0A%1B%5B1;32mCompilers/3goals/.todo%1B%5B0m:6:%1B%5B30;43mNB%1B%5B0m%20parsing%20alone%20solves%20most%20of%20the%20compiler%20related%20problems%1B%5B0m%1B%5BK%0A%1B%5B1;32mCompilers/3goals/.todo%1B%5B0m:12:%20%20%20%20%20%20%20%20%20%20%20%20%1B%5B30;43mNB%1B%5B0m%1B%5B0m%1B%5BK%0A%1B%5B1;32mDjango/.todo%1B%5B0m:10:%20%20%20%20%20%20%20%20%20%20%20%20%1B%5B30;43mNB%1B%5B0m%20Pinar%1B%5B0m%1B%5BK%0A%1B%5B1;32mDjango/Django-admin.py/.todo%1B%5B0m:9:%20%20%20%20%20%20%20%20%20%20%20%20%1B%5B30;43mNB%1B%5B0m%20install%20the%20tab%20completion%1B%5B0m%1B%5BK%0A%1B%5B1;32mDjango/GettingStarted/Basics-manage.py-startapp/.todo%1B%5B0m:7:%20%20%20%20%20%20%20%20%20%20%20%20%1B%5B30;43mNB%1B%5B0m%20__init__.py%20is%20also%20created%1B%5B0m%1B%5BK%0A%1B%5B1;32mDjango/GettingStarted/tempaltetags/.todo%1B%5B0m:11:%20%20%20%20%20%20%20%20%20%20%20%20%1B%5B30;43mNB%1B%5B0m%20tests%1B%5B0m%1B%5BK%0A%1B%5B1;32mED-SED/SED/Flags/.todo%1B%5B0m:5:%20%20%20%20%20%20%20%20%20%20%20%20%1B%5B30;43mNB%1B%5B0m%20combine%20statements%1B%5B0m%1B%5BK%0A%1B%5B1;32mED-SED/SED/Getting-started/.todo%1B%5B0m:26:%20%20%20%20%20%20%20%20%20%20%20%20%1B%5B30;43mNB%1B%5B0m%20swaps%20the%20words%1B%5B0m%1B%5BK%0A%1B%5B1;32mED-SED/SED/Getting-started/.todo%1B%5B0m:35:%20%20%20%20%20%20%20%20%20%20%20%20%1B%5B30;43mNB%1B%5B0m%20the%20use%20of%20%5C1,%20which%20takes%20the%201st%20match%1B%5B0m%1B%5BK%0A%1B%5B1;32mED-SED/SED/Getting-started/.todo%1B%5B0m:41:%20%20%20%20%20%20%20%20%20%20%20%20%1B%5B30;43mNB%1B%5B0m%20add%20brackets%20around%20each%20matches%1B%5B0m%1B%5BK%0A%1B%5B1;32mED-SED/SED/Getting-started/.todo%1B%5B0m:51:%20%20%20%20%20%20%20%20%20%20%20%20%1B%5B30;43mNB%1B%5B0m%20remove%20duplicates%1B%5B0m%1B%5BK%0A%1B%5B1;32mED-SED/SED/Matches/.todo%1B%5B0m:3:%20%20%20%20%20%20%20%20%1B%5B30;43mNB%1B%5B0m%20sed%20-ie%20%27s/SO/so%27%20app.yaml%1B%5B0m%1B%5BK%0A%1B%5B1;32mEmacs/.todo%1B%5B0m:21:%1B%5B30;43mNB%1B%5B0m%20same%20commands%20as%20in%20terminal%1B%5B0m%1B%5BK%0ABinary%20file%20Emacs/keybindings/emacs-keywords.png%20matches%0A%1B%5
هل كانت مفيدة؟

المحلول

يأخذ فايرفوكس عناوين URL في سطر الأوامر؛ فتح يأخذ الملفات. Stdout ACK ليس عنوان URL (أو ملف). بدلا من ذلك، ستحتاج إلى كتابة إخراج ACK إلى ملف، ويفتح فايرفوكس ذلك.

ack-grep -a NB > ~/ack-out.txt
open -a Firefox ~/ack-out.txt

لست متأكدا لماذا يريد للقيام بذلك، ولكن هذا يجب أن تعمل. لاحظ أنك ربما لن تحصل على اللون بهذه الطريقة؛ ACK لا يكتب HTML AFAIK.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top