Tagged Questions
3
votes
5answers
167 views
Regex match in CLI
Is there something like a logical for the cli? I want to achieve this
mv -t newfolder *.(png|jpg)
so that alls jpg and png files are moved into newfolder. I know it could be done with
mv -t ...
5
votes
1answer
2k views
What is the .gitignore pattern equivalent of the regex (Big|Small)(State|City)-[0-9]*\.csv
I have a regex I stuck in my .gitignore similar to:
(Big|Small)(State|City)-[0-9]*\.csv
It didn't work so I tested it against RegexLab.NET.
I then found the gitignore man page which led me to ...
1
vote
1answer
488 views
Difficulty making a regular expression to find at least 2 occurrences of a character in a file
I have a file containing random codes. Each code has ten characters in it, and I am trying to grep codes in the file that have at least 2 occurrences of a character. I am doing this:
grep DD* ...
11
votes
4answers
448 views
How do I choose specific files in a different directory using bash?
I want to list (or delete, or do some other operation) on certain files in a directory, like this:
$ ls /opt/somedir/
aa bb cc aa.txt bb.txt cc.txt
$ ls /opt/somedir/(aa|bb|cc) ## pseudo-bash ...
