Skip to content

Tag: bash

Re-write write-protected file

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…

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…

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…

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