Why wont this awk script work, where I want to print the min and max of an input by just reading the data once. I would also like to initialize the min and max variable with the first value of the data. Say I have a file I am using awk to print the min and max with: But I
Tag: bash
Cleanup output from GDB memory dump
We lost a configuration file which we were able to recover some of the data with a gdb memory dump but many important parts of the file are buried in memory noise. Is there a way to cleanup the dump files? Example output Answer The strings command was able to remove the garbage from the file.
Setting environment variable to command in a script
I made a bash script. It reads a file contains a list of commands and runs each of them. A list of commands is like below. Each line has a environment variable before command to set same name but different value to commands. A script is like below. I expect: run command1 with ENV_NUMBER=1 run command2 with ENV_NUMBER=2 run command3
How to introduce an input in a C program through shell script?
When I execute the program in console I just do this: and it just print a integer. The thing here is that I want to introduce 1000 textfiles as input so I made this script: The trouble here is that the script is not putting the output in the file text because is not iterating as it should, I think
Stop running script but not programm it started
I have a script on my Raspberry Pi that starts the browser in kiosk mode. But if I do so the script keeps running even if i pipe the output to /dev/null like this ./script 2> /dev/null If i stop the script with ctrl+c the browser gets killed as well. How can I run the script without having it to
How to change java version within a bash script?
I have one piece of a script that needs a different java version to the rest of the script, up till now I’ve always manually changed versions with sudo update-alternatives –config java and then just select the one I need. Is there a way to do that within a bash script? I’ve tried export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64/bin/java which matches the path listed
How do I create the same directory in every subdirectories in bash?
I’ve been trying to create the directory “a” inside all the subdirectories of “example”. What I tried is the following: But it doesn’t take the ‘*’ as a wildcard, returning mkdir: can not create «example/*/a» directory: It doesn’t exist file or directory Note that I have too much subdirectories in example, so I can’t do it by creating a list.
Get string between two regex
I have a string that is like that(comes from a curl command’s body): The server returns an xml Sometimes this strong can become or some other error: I’m wonder what would be the best way to grep the status code 200 and if it is not 200. Give an error like “Status code is 500 with error: java.lang.IllegalStateException: Archive not
How to get filenames and md5sum from google bucket in csv format with gsutil ls
I am trying to to get all files from google cloud storage with md5sum and all as csv. Condition: run it from bash and use only linux commands When I run this: It returns yaml as a stream: What I’d like to see is this: Answer With a docker: Or use gsutil directly if installed: Steps: Run gsutil and pipe
How to echo group of arguments passed to a script, instead of each individual argument
I have this very basic script: That when running it: The output will be an echo of each argument like this: How can I modify it to echo the arguments in a group of 4 or less (the last group), like this: Answer You can use printf: rematk: At the end of the last line you’ll get a space character