Skip to content

Tag: bash

/proc/meminfo not updating when reading from ssh script

I have the following script in bash: I have my host PC and a target PC which I am copying to. Before I run this script I have already scp’d a big file into /tmp on the target. When I run this script it copies the file /tmp/big ok, but when it enters the loop to sync the flash and

Recover informations from CSV files with my awk script

I have this CSV files : I create a little script that allow me to recover the informations from my csv and to place them like this : My script is : But the result is : Or I want : Can you tell me why my script doesn’t works and why floats are not taken into account ? Thank

How to log the live output of a running process

I want to run a game server inside my Ubuntu machine. I want to run it in the background and write the live output of that process inside a log file. I tried using nohup and running the game server using “&” at the end but I couldn’t make it work the way I wanted. Then I started reading …

Linux/Shell slicing a large text file

Given File1 File2 I wish to make a method that basically does this So given a uniquename from file1 it will use its key from file2 to get what it’s link to. If it doesn’t find uniquename do nothing. MY ATTEMPT Answer The cut utility was designed for this type of data:

Bash script, find command, using wildcards or regex

I am writing a bash script that goes over all files in certain directory and: Picks the files with names that match a specified pattern Sorts them by data and time (date and time are part of the filename) Takes X oldest files Performs certain operations on them The pattern used to match the files is passed to…

how do I get bash globbing to work in script

I am trying to convert some of my ksh93 scripts to bash in cygwin. I have found 2 things right now that give me trouble. The first is a function I put in .bashrc was not recognized in the script. I put the function in the script to get around that. The second is that it won’t glob like it

Search string in file via bash but only work match

Find the only string name based on the sub string name in a file. Command used: What works: File content: Output (desired output): What does not work: File content: Output: Need output SomeApi-CURRENT.war Answer It appears, you are interested in the docBase attribute of your xml elements. Specifically those w…

What is the point of “grep -q”

I was reading the grep man page and came across the -q option, which tells grep to “not write anything to standard output. Exit immediately with zero status if any match is found, even if an error was detected.” I don’t understand why this could be desirable or useful behavior. In a program …