Every 4 hours files are updated with new information if needed – i.e. if any new information has been processed for that particular file (files correspond to people). I’m running this command to convert my .stp files (those being updated every 4 hours) to .xml files. My script is in Snakemake (pyt…
Tag: bash
printf in awk with Umlauts doesn’t work
Can somebody please give me an alternative to the following awk statement. As soon as I give a “n” for string, it skips after Umlaut. I don’t want to use gsub because I have many special characters and don’t want to write a script for this. Also if not in awk, can somebody help me in o…
crontab shell script starts another script: remove char error
I want to run a shell script through crontab which does something and then runs another shell script which checks a certain folder for certain files and creates a directory for each file. The first script “my_crontab.sh” looks like this: Crontab executes “my_crontab.sh” and “star…
Run shell script exactly once with cronjob
I have a cron job that calls a script that checks for updates once every hour. If there are updates, it will call update.sh, which in turn calls commands.sh. I would like each “new” commands.sh to be run exactly once. I was thinking of writing to a file each time I run commands.sh with some unique…
BASH regex check not matching on linux
I have been scripting something in BASH and I have found a strange bug. I have been developing on Mac (El Capitan) and everything is working flawlessly. But deployment on Ubuntu 16.06 server is failing and I have no idea why. My code follows for input 6LfMYB8TAAAAACRZ9bP-0GN9y4zKUYPtj255-e8A this fails. And f…
Customize linux terminal PS1 variable in a function before starting a session
I often start a terminal session to servers from different tabs of my terminal. I would like to create a function that before starting the session it changes the title of the tab so that I can easily recognize which tab has which session open. Let’s pretend here that my session is an ssh session. When I…
Subprocess doesn’t respect arguments when using multiprocessing
The main objective here is to create a daemon-spawning function. The daemons need to run arbitrary programs (i.e. use subprocess). What I have so far in my daemonizer.py module is: When trying to run this in bash (This will create a file called test.log in your current directory.): It correctly spawns a daemo…
move single string up into previous row
I have been trying to solve a problem for hours and haven’t found a solution. I am trying to reformat a text file that has been incorrectly parsed. The file format contains a list of names, starting with the last name first, and has a troublesome sole first name on one of the rows as below: I have tried…
Extract text with any command in linux shell
How do I extract the text from the following text and store it to the variables: Here, I want to store 05 in one variable, 21 in another, 09 in another and so on. All the value must me stored in array or in separate varibles. I have tried: I need a more clear solution or short solution. Answer Your
How to delete numbers, dashes and underscores in the beginning of a file name
I have thousands of mp3 files but all with unusual file names such as 1-2songone.mp3, 2songtwo.mp3, 2_2_3_songthree.mp3. I want to remove all the numbers, dashes and underscores in the beginning of these files and get the result: Answer This can be done using extended globbing: This uses parameter expansion: …