Skip to content

Tag: macos

Trouble writing bash sed command – regex match

I have a file full of garbage collection information that is irregular, some lines have extra information that I want to initially remove so I can then process the the file as a whole. Unfortunately the line has quite a few special characters and I am struggling with a sed command that manages to match the bi…

Extract only the in plist using bash in Mac

I want to extract the key value in Countries in the following plist. For example, I want the output file contains the following keys only: But if I use the following script, It will print all the nested element under Countries including: Capital Washington DC Continent North America. How can I modify the scri…

How to create a system-wide file lock?

I am trying to have a number of independent processes coordinate their writing to file using a system-wide lock (see here: Concurrent file accesses from different scripts python) The lock needs to span the whole system, because the processes are spawn independently and at different times. Here: System-wide mu…

Mac equivalent for find -printf

Is there a MacOS terminal equivalent to Mainly, I want to replicate the -printf behaviour on a Mac. Answer The unix command line tools Apple ships are terribly outdated; sometimes 12 or 15 years old. You can install find from Macports: That version of find has the -printf option.

Curl/sed command not processing inputs correctly

I’m having some trouble with getting this to do what I want it to do. So basically what I want is to use curl to get a .txt file from a url, then sort through it to find the word specified by the user input. Then mark all those words with a * and put them in a file specified