Skip to content

Tag: bash

Provide windows avilable cores

I use the following in my script to find how many available cores I can use. This is for Linux: This is for Mac (darwin): How should it be in Windows? Answer You can use one of those commands: (here you have two physical processors) Or as suggested in comments: In Makefile the record should be something like:…

Symbolic Link Edits and differences to hard link [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers. This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack …

Remove newline before a match – Linux

I want to remove the newline before the </script> in my HTML file with a Linux command (sed, awk…). Sample input: Sample output: I tried different syntax, but none of them could do. Answer First of all, as mentioned in the comments Don’t parse XML with Regex! Never do it, never think about i…

How to grep within a loop to exclude?

I have a NPM_RESERVED_SCOPE that contains a comma-separated list of forbidden scope. I have a NPM_ALLOWED_DEV_DEPENDENCIES_PACKAGES that contains a comma-separated list of exception. I want this script to passe if the devDependencies does not contains any of the NPM_RESERVED_SCOPES, except the list of excepti…

Bash select multiple values in CSV column

I have the following CSV format: “/opt=920MB;4512;4917;0;4855″,”/=4244MB;5723;6041;0;6359″,”/tmp=408MB;998;1053;0;1109″,”/var=789MB;1673;1766;0;1859″,”/boot=53MB;656;692;0;729” I would like to extract 2 values from each column, the first and the last…