Skip to content
Advertisement

Tag: shell

Possible to combine glob sort w/ alternation in zsh?

Looking for a shell-only[1] way to take this list of dirs: And return it sorted numerically, with the subdirs showing up right after their parent: (*|*/bar)(n) is rejected as a bad pattern, while */{,bar}(n) expands to */(n) ~/bar(n) so the subdirs show up at the end. [1] I need this to be able to work on a wide variety of

Use php exec to launch a linux command with brace expansion

How can I force the php exec() to interpret the linux brace expansion? I am encountering a strange behavior, and did not find a way to fix it the way I want. I want to execute a linux command containing brace expression to select a batch of files, from php I am using php to generate a “random” number of

How to extract something out of a file after greping?

How can I extract group-3-vm1 after I do this grep? Here’s the result: Answer This awk command replaces the grep and tail commands while also extracting the text of interest: How it works -F'[:/]’ This sets the field separator to either a colon or a slash. /Tracking URL/{n=$4;} This looks for lines containing Tracking URL and saves the fourth field

Embedding bash commands

I’m using virtualenvwrapper and trying to create a virtualenv using a version of python that’s not the default. What I’d like to do is: …But without the copy-paste. Is there a way to do this in one line? Answer is the correct way to write this as a one-liner. type is a POSIX standard utility, so it is more likely

Grep regexp for matching ip addresses in a file

I’m trying to search a file “Sessions” that contains IP addresses (among other useless junk). My Grep is failing to match, even though REGEXR is matching perfectly all the IPs perfectly … so I know the REGEX is correct … but when I GREP for this same pattern, not is returned. I’ve tried a variation of ways on that GREP

In C# , how to set English time zone when formating a DateTIme?

private static SimpleDateFormat formatter = new SimpleDateFormat(“dd/MMM/yyyy:HH:mm:ss Z”, Locale.ENGLISH); string startTime = formatter.format(DateTime.Now); //请求时间 Those are Java codes. Can you help me convert the Java codes to equaivlent(equal) C#(.net) codes? I know to use DateTime.Now.ToString(“dd/MMM/yyyy:HH:mm:ss Z “) ,but the core problem is that I don’t know how to set the time to English time. I have struggled for half a

Advertisement