Hacker News new | more | comments | ask | show | jobs | submit login

[ edit: this apparently does not get the annexes ]

For those who want to grep it ...

download ...

wget http://www.mfat.govt.nz/downloads/trade-agreement/transpacif...

unzip ...

unzip TPP_All-Chapters.zip

convert to text ...

pdftotext "0. Preamble.pdf" 0.Preamble.txt

pdftotext "1. Initial Provisions and General Definitions Chapter.pdf" 1.InitialProvisionsandGeneralDefinitionsChapter.txt

pdftotext "2. National Treatment and Market Access for Goods Chapter.pdf" 2.NationalTreatmentandMarketAccessforGoodsChapter.txt

pdftotext "3. Rules of Origin and Origin Procedures Chapter.pdf" 3.RulesofOriginandOriginProceduresChapter.txt

pdftotext "4. Textiles and Apparel Chapter.pdf" 4.TextilesandApparelChapter.txt

pdftotext "5. Customs Administration and Trade Facilitation Chapter.pdf" 5.CustomsAdministrationandTradeFacilitationChapter.txt

pdftotext "6. Trade Remedies Chapter.pdf" 6.TradeRemediesChapter.txt

pdftotext "7. Sanitary and Phytosanitary Measures Chapter.pdf" 7.SanitaryandPhytosanitaryMeasuresChapter.txt

pdftotext "8. Technical Barriers to Trade Chapter.pdf" 8.TechnicalBarrierstoTradeChapter.txt

pdftotext "9. Investment Chapter.pdf" 9.InvestmentChapter.txt

pdftotext "10. Cross-Border Trade in Services Chapter.pdf" 10.Cross-BorderTradeinServicesChapter.txt

pdftotext "11. Financial Services Chapter.pdf" 11.FinancialServicesChapter.txt

pdftotext "12. Temporary Entry for Business Persons Chapter.pdf" 12.TemporaryEntryforBusinessPersonsChapter.txt

pdftotext "13. Telecommunications Chapter.pdf" 13.TelecommunicationsChapter.txt

pdftotext "14. Electronic Commerce Chapter.pdf" 14.ElectronicCommerceChapter.txt

pdftotext "15. Government Procurement Chapter.pdf" 15.GovernmentProcurementChapter.txt

pdftotext "16. Competition Policy Chapter.pdf" 16.CompetitionPolicyChapter.txt

pdftotext "17. State-Owned Enterprises and Designated Monopolies Chapter.pdf" 17.State-OwnedEnterprisesandDesignatedMonopoliesChapter.txt

pdftotext "18. Intellectual Property Chapter.pdf" 18.IntellectualPropertyChapter.txt

pdftotext "19. Labour Chapter.pdf" 19.LabourChapter.txt

pdftotext "20. Environment Chapter.pdf" 20.EnvironmentChapter.txt

pdftotext "21. Cooperation and Capacity Building Chapter.pdf" 21.CooperationandCapacityBuildingChapter.txt

pdftotext "22. Competitiveness and Business Facilitation Chapter.pdf" 22.CompetitivenessandBusinessFacilitationChapter.txt

pdftotext "23. Development Chapter.pdf" 23.DevelopmentChapter.txt

pdftotext "24. Small and Medium-Sized Enterprises Chapter.pdf" 24.SmallandMedium-SizedEnterprisesChapter.txt

pdftotext "25. Regulatory Coherence Chapter.pdf" 25.RegulatoryCoherenceChapter.txt

pdftotext "26. Transparency and Anti-Corruption Chapter.pdf" 26.TransparencyandAnti-CorruptionChapter.txt

pdftotext "27. Administrative and Institutional Provisions Chapter.pdf" 27.AdministrativeandInstitutionalProvisionsChapter.txt

pdftotext "28. Dispute Settlement Chapter.pdf" 28.DisputeSettlementChapter.txt

pdftotext "29. Exceptions Chapter.pdf" 29.ExceptionsChapter.txt

pdftotext "30. Final Provisions Chapter.pdf" 30.FinalProvisionsChapter.txt




    for file in *.pdf; do pdftotext "${file}"; done
Less HN clutter ;)


It gets rid of the goldarn blanks in the filenames.


    for file in *.txt; do mv "${file}" "${file// /}"; done


Off-topic:

Wow thanks, I didn't know about that form of bash variable substitution!

It's documented under the heading:

    ${var/Pattern/Replacement}
at http://www.tldp.org/LDP/abs/html/parameter-substitution.html


WellIdidnotknowthat.thanks!


Blanks in the filenames are a problem? Is this MS DOS 6?


Blanks are only a problem for people that haven't read bash(1). Once you learn to simply use "$@" everywhere, you never worry about blanks again.


Since space is the standard argument separator in most shells, yes, obviously. The problem can be worked around/handled in various ways, but it's still a problem, of course.


They're at least annoying for some people to deal with.




Applications are open for YC Summer 2019

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact

Search: