the script below sets up a test suite and runs the renaming procedure, according to the criteria
#!/bin/bash
# setting up testing data
dataset=.
mkdir -p "$dataset"/Nishi_{001..005}...
Type: Posts; User: Vaphell; Keyword(s):
the script below sets up a test suite and runs the renaming procedure, according to the criteria
#!/bin/bash
# setting up testing data
dataset=.
mkdir -p "$dataset"/Nishi_{001..005}...
post the actual error message. Syntax error has nothing to do with the math. It's about the technical side of the code itself: missing parentheses, incorrect indentation and such.
i don't think python works differently in the domain of binary operators. I'd assume the job is farmed out to underlying C code.
Maybe in that specific case you took advantage of the truthiness of...
https://docs.python.org/2/reference/expressions.html#operator-precedence
>> is binds more strongly than &, so dta gets shifted first and then the result is binary-ANDed.
&1 takes only...
are you sure you put it in the very first line? If not, then your shebang is nothing but a comment (#)
a quick research led me to this quick and dirty rule:
python int is int64.
if you mix unsigned types with it you get escalation to the int of higher width if possible to accomodate values outside...
800_D1_TOC/800-d1-tocaree.xcf is supposed to become 800_D1_TOC/800_D1_TOC?
assuming there is only 1 item in a relevant dir
dirs=( 800_D1_TOC
800_D1_ATA
800_D1_MTN
...
have you tried multiplying the shorter list by a number and then trimming it to specific length?
try lowercasing the type name.
>>> import numpy
>>> numpy.Float32
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute...
#!/bin/bash
shopt -s globstar
for f in **/*.[Ww][Mm][Aa]
do
path=${f%/*}
filename=${f##*/}
new=${filename// /_} # space -> underscore
new=${new,,} # lowercase
a case of brainfart
find ./folder -type f -exec sed -r -i '/pattern/d' {} +
what's wrong with loops?
shopt -s globstar
sed -r -i '/pattern/d' ./folder/**/*
globstar for recursiveness, if the files are directly under folder then folder/* would cut it
without...
the first thing to mention is that there are 2 flavors of pattern matching in bash. Regular expressions used only with [[ =~ ]] and globs used everywhere else, less potent than regexes (then there...
easy peasy
case 1 - you are asking whether there is a digit (single at that) which makes anything with a single digit pass even, things like x0xoxoxoxoxox, which can be confirmed by printing out...
if you don't care about realtime output you can do something like this
#!/usr/bin/env python3
import subprocess as sub
cmd = [ 'bash', '-c', '{ for i in {1..5}; do echo "$i"; echo "errrr...
well, both methods are logically equivalent, so whatever blows your hair back. Direct index is simpler though.
and yes, my example dealt with capturing groups only, 0-th element was intentionally...
both [0] and [1]. It doesn't matter that they have the same value.
$ [[ '123' =~ (1) ]] && printf '%s\n' "${BASH_REMATCH[@]}"
1 total match
1 capturing group...
even more compact
$ name=$( awk -F= '/^DISTRIB_ID/ { print tolower($2); }' /etc/*release )
$ echo "$name"
ubuntu
1 command instead of 4.
is there a reason why you are after NAME not ID?
$ name=$( lsb_release -si )
$ name=${name,,}
$ echo "$name"
ubuntu
and if you really need to mangle etc/*release
you can also leave the tilde outside the quotes for it to work, but the best solution imo would be to stop depending on shell unrolling the ~ shortcut and use $HOME that always works instead.
the problem is that bash doesn't really support regexes and its native globs are functionally a barebone subset of true regexes. There is also an extended variant of globs but they still fall short....
I don't think it will be THAT easy, i doubt selenium, no matter how awesome it might be, will expose remote code in foreign language as first class functions
Python is secondary here, you do...
python + selenium using PhantomJS driver for a virtual webbrowser?
#!/usr/bin/env python3
from selenium import webdriver
url = 'http://xxx.yyy.com'
dir is indeed superfluous, i thought i will need it, but then i didn't and forgot to remove it
I mean string operations on paths to get a rock solid transformation from src_path to dest_path...
you go down 2 levels (*/*/) with cd but go up only 1 (..)
That said personally i prefer to avoid cd-ing over the directory tree, i just transform paths
#!/bin/bash
dest=$HOME/test/crap/v0
...