for each line of a file, grep a specific string and make string substitution

Bash
I have a file containing more than 14000 records. What I want to do is to process this file line by line and replace a String by anodher string return...
1 year ago

how to configure multiple shell scripts on Jenkins and run them without waiting for the other script

Bash
I am trying to run a shell script from jenkins which is of the following form ssh host1 'nohup path/script.sh &' ssh host2 'nohup path/script.sh...
1 year ago

payload is not valid JSON

Bash
I'm using curl to send JSON to an API endpoint. However, somewhere in the bash chain it is getting messed up. Is there something special to know abou...
1 year ago

Find Git branch name in post-update hook

Bash
I'm executing a programme to alert CruiseControl each time an update is sent to our remote repository. I'm using a Git post-update hook for this. It ...
1 year ago

Best(?) way to make a popup menu for semi-portable shell scripts?

Bash
Basically I would love to say: echo `grep ^foo /usr/share/dict/words | popup_menu` ...and have some type of keyboard navigable menu popup or sele...
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

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

How can I count all zeros before the first non-zero number

Bash
This is the issue here: echo -0.00092711066827 | grep -o 0 0 0 0 0 0 echo -0.00092711066827 | grep -o 0 | wc -l 5 but I need to count all zeros ...
1 year ago

Getting exit code of shell execution inside define

Bash
I have something like this in my makefile: exit_code := $(shell some_script.py; echo $$?) ifneq ($(exit_code),0) $(error Error occured) endif a...
1 year ago

How can I open a shell with a command in python?

Bash
The following command opens a new shell and opens nano in it, when I type it into bash: gnome-terminal -e "bash -c 'nano test; bash'" So I tried th...
1 year ago

Bash script - if and else if statements

Bash
I am quite new to bash scripts so take it easy on me;). I have a file which does some checks before initiating a /warner file which sends an email. ...
1 year ago

Bash: duplicate + rename folder

Bash
Suppose I have a folder named my_folder_old in /path/to/folder, how can I create a duplicate named my_folder_new in the same directory? EDIT Moreove...
2 years ago

In shell script will sync cmd wait until first cmd is executed completely

Bash
In shell script will second cmd wait until first cmd is executed completely ie in case of sync folders ? eg : cmd1 sync folder1 cmd2 cp folder1 to...
2 years ago

How to load ~/.bash_profile when entering bash from within zsh?

Bash
I've used bash for two years, and just tried to switch to zsh shell on my OS X via homebrew. And I set my default (login) shell to zsh, and I confirme...
2 years ago

Concatenate and remove carriage return in Shell Script

Bash
In shell script I am doing the following: locationUrl=$(grep -r "Location:" output.txt) fullUrl="http://test.com/temp/${locationUrl##*/}" tempUrl="$f...
2 years ago

In bash how can I split a column in several column of fixed dimension

Bash
how can I split a single column in several column of fixed dimension, for example I have a column like this: 1 2 3 4 5 6 7 8 and for size p. ex 4, ...
2 years ago

Trim last 3 characters of a line WITHOUT using sed, or perl, etc

Bash
I've got a shell script outputting data like this: 1234567890 * 1234567891 * I need to remove JUST the last three characters " *". I know I can ...
2 years ago

Extract substring in bash

Bash
Looking for a solution in bash (will be part of a script). Given a filename in the form "someletters_12345_moreleters.ext", I want to extract the 5 d...
2 years ago

shell - temp IFS as newline only. Why doesn't this work: IFS=$(echo -e '\n')

Bash
I'm trying to use for in the shell to iterate over filenames with spaces. I read in a stackoverflow question that IFS=$'\n' could be used and that see...
2 years ago

Batch Renaming with Bash

Bash
How can Bash rename a series of packages to remove their version numbers? I've been toying around with both expr and %%, to no avail. Examples: Xft2...
2 years ago