Python create a Popen shell command list

Bash
Please can someone help me create a Popen command line list from this... identify -format %b:%w:%h:%r:%# myimage.jpg I have... cmd=Popen(['ide...
1 year ago

`find -name` pattern that matches multiple patterns

Bash
I was trying to get a list of all python and html files in a directory with the command find Documents -name "*.{py,html}". Then along came the man p...
1 year ago

sed scripting - environment variable substitution

Bash
I have sed related question: If I run these command from a scrip: #my.sh PWD=bla sed 's/xxx/'$PWD'/' ... $ ./my.sh xxx bla Which is fine. But, if...
1 year ago

perl hash output differs from shell hash output

Bash
I am trying to do a simple sha512 hash of a string: somekeyidentifier0 When I hash it using the openssl command in SHELL, I get this: echo -n some...
1 year ago

How to split a string and extract its specific elements?

Bash
I need split a string and extract specific elements. For instance, I have str str='C50F2N2Ne50A13.224343968R2' And than, I need extract ... C = 5...
1 year ago

"Ignore" quotes in positional parameters in my Bash script

Bash
I have a script that has SMS forwarded to it and posts some of that data to a PHP script. Below is my Bash script: #!/bin/bash # Script to post dat...
1 year ago

extract date from a file name in unix using shell scripting

Bash
I am working on shell script. I want to extract date from a file name. The file name is: abcd_2014-05-20.tar.gz I want to extract date from it: 2014...
1 year ago

Merging nested directories by name

Bash
I am looking for a way to merge the contents of two nested directories if their names match. The new combined folder needs to be placed in a new direc...
1 year ago

getopts printing help when no cmd. line argument was matched

Bash
I'm trying to use getopts in bash to parse command line arguments, but I couldn't figure out how to implement "default" action, if no argument was mat...
1 year ago

Can we split a Big HDFS Folder?

Bash
I have a hdfs folder sized around 570 TB, there are number of sub folders and I wanted to split one of the sub folder which is of around 530 TB.
1 year ago

How to check if running in Cygwin, Mac or Linux?

Bash
I have a shell script that is used both on Windows/Cygwin and Mac and Linux. It needs slightly different variables for each versions. How can a shel...
1 year ago

Shell Script file access

Bash
I have written a shell script on my mac. Following code: echo [objects] > temp.prj echo $1.obj >> temp.prj chmod 777 temp.prj wla-6...
1 year ago

How to programmatically determine the current checked out Git branch

Bash
In a Unix or GNU scripting environment (e.g. a Linux distro, Cygwin, OSX), what is the best way to determine which Git branch is currently checked out...
1 year ago

How to create shell script for creating logs on linux server based on hostname

Bash
All, I have a requirement that if the hostname of the server starts with tm1 or dm1 then it should create gz1 format of log files , if the hostname s...
1 year ago

How to suppress over-verbose xpath-output?

Bash
I'm using xpath (as supplied in Mac OS X 10.9 usr/bin/xpath5.16) in a shell script to parse some values from an XML file which works really well. Howe...
1 year ago

UNIX: How do I output data from 2 files using a loop structure?

Bash
Good afternoon everyone, I have a project I am working on, but I am having a bit of trouble with it. I am supposed to create a script that uses a loop...
1 year ago

Bash and Dash inconsistently check command substitution error codes with `errexit`

Bash
I seem to have encountered a very, very strange inconsistency in the way both dash and bash check for error conditions with the errexit option. Using...
1 year ago

Create new file containing filename and count each file

Bash
I need to create a new file_count.txt containing filename and line count. Directory Structure $ find asia emea -name \*.gz asia/2013/emp_asia_13...
1 year ago

Scope of variables executing functions in a subshell

Bash
That's what happens when a command is executed in a subshell environment: The command will run in a copy of the current shell execution environment ...
1 year ago

How do I calculate the mean of a column

Bash
Anyone know how can I calculate the mean of one these columns (on linux)?? sda 2.91 20.44 6.13 2.95 217.53 186.67 44.5...
1 year ago