Skip to content
Advertisement

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 bit I want to

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 script so that it will only print

How to grep recursively and ignore subdirectories of subdirectories?

I am already familiar with grep -r “searchTerm” . and I am familiar with grep -r “searchTerm” exclude={subdir1, subdir2} . However, I am looking for a way to grep recursively, through subdirectories and ignore certain subdirectories of subdirectories. For example, if the directory structure is as follows: How would I be able to exclude idc and otherStuffIdc, since these folders

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 mutex in Python on Linux I read that fcntl.lockf should do what

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

Advertisement