Skip to content

Tag: bash

How to format decimal space using awk in linux

original file : now i need to control third columns with 6 decimal space after i tried awk {‘print $1,$2; printf “%.6ft”,$3’} but the output is not what I want result : that’s weird , how can I do that will just modify third columns Answer Your print() is adding a newline charact…

awk in non-interactive is leaving some data missing

I’m running an awk command in a shell script, and it’s breaking the datafile. All of the data doesn’t load, and there’s a newline character at the end of each line. If I run this as a command, it works perfectly. I’ve just found that i can use fflush() and it seems to have solved…

Cronjob script isn’t working as expected

I have a script that work perfectly fine when I manually run it by myself, but does not seem to run properly from crontab. The main error is that the (external) environment variables are not being set. I added SHELL=/bin/bash above the cronjob definition but still got the same errors. The script I have copied…

Print text in between a string pattern and a new line in bash

I have a text file that looks like this: and I’m trying to print the part between 29.04.16_09.35 (included) and the first empty line. I thought sed would work and tried using this code: but it prints everything from 29.04.16_09.35 to the end of the file. I also tried by using a single n but it still pri…

link files within directory, with simple command similar to cp

Where my question originated: When running cp source/files.all destination/, all the files within source will now also exist in destination Question: What if I didn’t want to duplicate the data from source into destination, but simply link them (with absolute path). Usually, I would run something like: …